From a16ef43066aca09038832223f470b1623c0efadd Mon Sep 17 00:00:00 2001 From: aboyko Date: Tue, 13 Sep 2022 16:35:42 -0400 Subject: [PATCH] Auto-Connect on by default. Unit test. --- .../BootLaunchConfigurationDelegateTest.java | 21 ++++++++++++++----- .../BootLaunchConfigurationDelegate.java | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot.launch.test/src/org/springframework/ide/eclipse/boot/launch/test/BootLaunchConfigurationDelegateTest.java b/eclipse-extensions/org.springframework.ide.eclipse.boot.launch.test/src/org/springframework/ide/eclipse/boot/launch/test/BootLaunchConfigurationDelegateTest.java index 3a4ebb29e..6f0e57921 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.boot.launch.test/src/org/springframework/ide/eclipse/boot/launch/test/BootLaunchConfigurationDelegateTest.java +++ b/eclipse-extensions/org.springframework.ide.eclipse.boot.launch.test/src/org/springframework/ide/eclipse/boot/launch/test/BootLaunchConfigurationDelegateTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2018 Pivotal Software, Inc. + * Copyright (c) 2015, 2022 Pivotal Software, Inc. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,13 +16,10 @@ import java.io.File; import java.net.URL; import java.time.Duration; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.Properties; import java.util.function.Predicate; -import javax.xml.transform.stream.StreamResult; - import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; @@ -41,7 +38,6 @@ import org.springframework.ide.eclipse.boot.launch.livebean.JmxBeanSupport; import org.springframework.ide.eclipse.boot.launch.process.BootProcessFactory; import org.springframework.ide.eclipse.boot.test.util.LaunchResult; import org.springframework.ide.eclipse.boot.test.util.LaunchUtil; -import org.springsource.ide.eclipse.commons.frameworks.test.util.ACondition; import org.springsource.ide.eclipse.commons.frameworks.test.util.Timewatch; import org.springsource.ide.eclipse.commons.tests.util.StsTestUtil; @@ -166,6 +162,21 @@ public class BootLaunchConfigurationDelegateTest extends BootLaunchTestCase { assertEquals(false, BootLaunchConfigurationDelegate.getFastStartup(wc)); } + public void testSetGetAutoConnect() throws Exception { + ILaunchConfigurationWorkingCopy wc = createWorkingCopy(); + assertEquals(true, BootLaunchConfigurationDelegate.getAutoConnect(wc)); + + BootLaunchConfigurationDelegate.setAutoConnect(wc, false); + assertEquals(false, BootLaunchConfigurationDelegate.getAutoConnect(wc)); + + IProject project = createLaunchReadyProject(TEST_PROJECT); + + //Creates a launch conf similar to that created by 'Run As' menu. + wc = createWorkingCopy(); + BootLaunchConfigurationDelegate.setDefaults(wc, project, TEST_MAIN_CLASS); + assertEquals(true, BootLaunchConfigurationDelegate.getAutoConnect(wc)); + } + public void testClearProperties() throws Exception { ILaunchConfigurationWorkingCopy wc = createWorkingCopy(); BootLaunchConfigurationDelegate.setRawApplicationProperties(wc, diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot.launch/src/org/springframework/ide/eclipse/boot/launch/BootLaunchConfigurationDelegate.java b/eclipse-extensions/org.springframework.ide.eclipse.boot.launch/src/org/springframework/ide/eclipse/boot/launch/BootLaunchConfigurationDelegate.java index 02c0fb6e0..4c9224f9d 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.boot.launch/src/org/springframework/ide/eclipse/boot/launch/BootLaunchConfigurationDelegate.java +++ b/eclipse-extensions/org.springframework.ide.eclipse.boot.launch/src/org/springframework/ide/eclipse/boot/launch/BootLaunchConfigurationDelegate.java @@ -366,7 +366,7 @@ public class BootLaunchConfigurationDelegate extends AbstractBootLaunchConfigura setMainType(wc, mainType); } setEnableJMX(wc, DEFAULT_ENABLE_JMX); - setAutoConnect(wc, false); + setAutoConnect(wc, DEFAULT_AUTO_CONNECT); setEnableLiveBeanSupport(wc, DEFAULT_ENABLE_LIVE_BEAN_SUPPORT()); setEnableLifeCycle(wc, DEFAULT_ENABLE_LIFE_CYCLE); setTerminationTimeout(wc,""+DEFAULT_TERMINATION_TIMEOUT);