repo-reorg-2020: moved sts4-relevant spring-ide bundles from https://github.com/spring-projects/spring-ide/releases/tag/REPO-REORG-2020 into sts4 repo

This commit is contained in:
Martin Lippert
2020-09-29 14:00:01 +02:00
parent 8edfab1a16
commit de16884b60
2210 changed files with 160282 additions and 43 deletions

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src">
<attributes>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.springframework.ide.eclipse.boot.launch.test</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1443121011770</id>
<name></name>
<type>14</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-projectRelativePath-matches-false-false-target</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>

View File

@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

View File

@@ -0,0 +1,59 @@
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
sp_cleanup.add_missing_override_annotations_interface_methods=true
sp_cleanup.add_serial_version_id=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_functional_interfaces=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=false
sp_cleanup.format_source_code_changes_only=false
sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=true
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=false
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
sp_cleanup.organize_imports=false
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
sp_cleanup.remove_unnecessary_casts=false
sp_cleanup.remove_unnecessary_nls_tags=false
sp_cleanup.remove_unused_imports=false
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
sp_cleanup.use_anonymous_class_creation=false
sp_cleanup.use_blocks=false
sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_lambda=true
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true

View File

@@ -0,0 +1,26 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Boot Launch Tests
Bundle-SymbolicName: org.springframework.ide.eclipse.boot.launch.test
Bundle-Version: 4.8.1.qualifier
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.junit,
org.springframework.ide.eclipse.boot.launch,
org.springsource.ide.eclipse.commons.tests.util,
org.eclipse.core.resources,
org.springsource.ide.eclipse.commons.livexp,
org.eclipse.debug.core,
org.eclipse.jdt.launching,
org.eclipse.jdt.core,
org.eclipse.jdt.debug.ui,
org.springframework.ide.eclipse.boot,
org.springsource.ide.eclipse.commons.frameworks.core,
org.springframework.ide.eclipse.boot.test,
org.springsource.ide.eclipse.commons.frameworks.test.util,
org.apache.commons.io,
org.apache.commons.lang3,
org.springframework.ide.eclipse.buildship30
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Vendor: GoPivotal Inc.

View File

@@ -0,0 +1,248 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>About Spring IDE</title>
<meta name="author" content="Spring IDE Developers">
</head>
<body>
<h2>About Spring IDE</h2>
<p>March 26, 2007</p>
<h3>Abstract</h3>
<p>Spring IDE is a set of plugins which provide a user interface for
<a href="https://www.springframework.org">The Spring Framework</a>'s bean
factory XML configuration files including support for Spring 2.0
namespaces, AOP configuration and Spring Web Flow.</p>
<h3>License</h3>
<p>The Spring IDE Project makes available all content in this
plug-in (&quot;Content&quot;). Unless otherwise indicated below, the
Content is provided to you under the terms and conditions of the Eclipse
Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is
available at <a href="https://www.eclipse.org/legal/epl-v10.html">https://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
<p>If you did not receive this Content directly from the Spring IDE
Project, the Content is being redistributed by another party
(&quot;Redistributor&quot;) and different terms and conditions may apply
to your use of any object code in the Content. Check the Redistributor's
license that was provided with the Content. If no such license exists,
contact the Redistributor. Unless otherwise indicated below, the terms
and conditions of the EPL still apply to any source code in the Content
and such source code may be obtained at <a href="https://www.eclipse.org">https://www.eclipse.org</a>.</p>
<h3>Third Party Content</h3>
<p>The Content includes items that have been sourced from third
parties as set out below. If you did not receive this Content directly
from the Spring IDE Project, the following is provided for informational
purposes only, and you should look to the Redistributor's license for
terms and conditions of use.</p>
<p><em> <strong>The Spring Framework v3.0.5</strong>
<p>This product includes software developed by the Spring Framework
Project (<a href="https://www.springframework.org">https://www.springframework.org</a>).</p>
<p><em> <strong>Spring Web Flow v2.0.7.A</strong>
<p>This product includes software developed by the Spring Framework
Project (<a href="https://www.springframework.org">https://www.springframework.org</a>).</p>
<p><em> <strong>Spring Web Services v1.5.8</strong>
<p>This product includes software developed by the Spring Framework
Project (<a href="https://www.springframework.org">https://www.springframework.org</a>).</p>
<p><em> <strong>Spring Security v3.0.2</strong>
<p>This product includes software developed by the Spring Framework
Project (<a href="https://www.springframework.org">https://www.springframework.org</a>).</p>
<p><em> <strong>Spring Dynamic Modules for OSGi(TM) Runtimes v2.0.0.M2</strong>
<p>This product includes software developed by the Spring Framework
Project (<a href="https://www.springframework.org">https://www.springframework.org</a>).</p>
<p><em> <strong>Spring Batch v2.1.0</strong>
<p>This product includes software developed by the Spring Framework
Project (<a href="https://www.springframework.org">https://www.springframework.org</a>).</p>
<p><em> <strong>Commons Codec v1.3.0</strong>
<p>This product includes software developed by The Apache Software
Foundation (<a href="https://www.apache.org/">https://www.apache.org/</a>).</p>
<p><em> <strong>Commons Collections v3.2.0</strong>
<p>This product includes software developed by The Apache Software
Foundation (<a href="https://www.apache.org/">https://www.apache.org/</a>).</p>
<p><em> <strong>Commons Logging v1.1.1</strong>
<p>This product includes software developed by The Apache Software
Foundation (<a href="https://www.apache.org/">https://www.apache.org/</a>).</p>
<p><em> <strong>Apache MyFaces v1.2.2</strong>
<p>This product includes software developed by The Apache Software
Foundation (<a href="https://www.apache.org/">https://www.apache.org/</a>).</p>
<p><em> <strong>AspectJ Weaver v1.6.10</strong>
<p>This product includes software developed by The Eclipse Software
Foundation (<a href="https://www.eclipse.org/">https://www.eclipse.org/</a>).</p>
<p><em> <strong>Antlr v3.0.1</strong>
<p>Spring IDE includes a binary version of Antlr v3.0.1 (<a
href="https://www.antlr.org">https://www.antlr.org/</a>).
The source code for Antlr is available from the Antlr download site at
<a href="https://www.antlr.org/download.html">https://www.antlr.org/download.html</a>.
<p>The Antlr license is available at <a
href="https://www.antlr.org/license.html">https://www.antlr.org/license.html</a>.
The license is also reproduced here:</p>
<pre>Copyright (c) 2003-2007, Terence Parr
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions
and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the author nor the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</pre></p>
<p><em> <strong>ASM v2.2.3</strong>
<p>Spring IDE includes a binary version of ASM v2.2.3 (<a
href="https://asm.objectweb.org/index.html">https://asm.objectweb.org/</a>).
The source code for ASM is available from the ObjectWeb download site at
<a href="https://asm.objectweb.org/download/">https://asm.objectweb.org/download/</a>.
<p>The ASM license is available at <a
href="https://asm.objectweb.org/license.html">https://asm.objectweb.org/license.html</a>.
The license is also reproduced here:</p>
<pre>Copyright (c) 2000-2005 INRIA, France Telecom
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
</pre></p>
<p><em> <strong>backport-util-concurrent 3.1.0</strong>
<p>Spring IDE includes a binary version of backport-util-concurrent v3.1.0 (<a
href="https://dcl.mathcs.emory.edu/util/backport-util-concurrent/">https://dcl.mathcs.emory.edu/util/backport-util-concurrent/</a>).
The source code for backport-util-concurrent is available from the download site at
<a href="https://dcl.mathcs.emory.edu/util/backport-util-concurrent/dist/">https://dcl.mathcs.emory.edu/util/backport-util-concurrent/dist/</a>.
<p>The backport-util-concurrent license is available at <a
href="https://creativecommons.org/licenses/publicdomain">https://creativecommons.org/licenses/publicdomain</a>.
The license is also reproduced here:</p>
<pre><em>Copyright-Only Dedication (based on United States law) or Public Domain Certification</em>
The person or persons who have associated work with this document (the
"Dedicator" or "Certifier") hereby either (a) certifies that, to the
best of his knowledge, the work of authorship identified is in the public
domain of the country from which the work is published, or (b) hereby
dedicates whatever copyright the dedicators holds in the work of authorship
identified below (the "Work") to the public domain. A certifier, moreover,
dedicates any copyright interest he may have in the associated work, and
for these purposes, is described as a "dedicator" below.
A certifier has taken reasonable steps to verify the copyright status of
this work. Certifier recognizes that his good faith efforts may not shield
him from liability if in fact the work certified is not in the public domain.
Dedicator makes this dedication for the benefit of the public at large and
to the detriment of the Dedicator's heirs and successors. Dedicator intends
this dedication to be an overt act of relinquishment in perpetuity of all
present and future rights under copyright law, whether vested or contingent,
in the Work. Dedicator understands that such relinquishment of all rights
includes the relinquishment of all rights to enforce (by lawsuit or otherwise)
those copyrights in the Work.
Dedicator recognizes that, once placed in the public domain, the Work may be
freely reproduced, distributed, transmitted, used, modified, built upon, or
otherwise exploited by anyone for any purpose, commercial or non-commercial,
and in any way, including by methods that have not yet been invented or
conceived.
</pre></p>
<p><em> <strong>AOP Alliance</strong>
<p>LICENCE: all the source code provided by AOP Alliance is Public Domain.
</p>
<p><em> <strong>javax.el v1.0.0</strong>
<p>This product includes software distributed by Sun (meanwhile Oracle) under CDDL license
(<a href="https://www.sun.com/cddl/cddl.html">https://www.sun.com/cddl/cddl.html</a>).</p>
<p><em> <strong>javax.jms v1.1.0</strong>
<p>This product includes software distributed by Sun (meanwhile Oracle) under CDDL license
(<a href="https://www.sun.com/cddl/cddl.html">https://www.sun.com/cddl/cddl.html</a>).</p>
<p><em> <strong>javax.servlet v2.5.0</strong>
<p>This product includes software distributed by Sun (meanwhile Oracle) under CDDL license
(<a href="https://www.sun.com/cddl/cddl.html">https://www.sun.com/cddl/cddl.html</a>).</p>
<p><em> <strong>javax.servlet.jsp v2.1.0</strong>
<p>This product includes software distributed by Sun (meanwhile Oracle) under CDDL license
(<a href="https://www.sun.com/cddl/cddl.html">https://www.sun.com/cddl/cddl.html</a>).</p>
<p><em> <strong>javax.servlet.jsp.jstl v1.2.0</strong>
<p>This product includes software distributed by Sun (meanwhile Oracle) under CDDL license
(<a href="https://www.sun.com/cddl/cddl.html">https://www.sun.com/cddl/cddl.html</a>).</p>
<p><em> <strong>javax.activation v1.1.0</strong>
<p>This product includes software distributed by Sun (meanwhile Oracle) under CDDL license
(<a href="https://www.sun.com/cddl/cddl.html">https://www.sun.com/cddl/cddl.html</a>).</p>
<p><em> <strong>javax.annotation v1.0.0</strong>
<p>This product includes software distributed by Sun (meanwhile Oracle) under CDDL license
(<a href="https://www.sun.com/cddl/cddl.html">https://www.sun.com/cddl/cddl.html</a>).</p>
<p><em> <strong>javax.mail v1.4.0</strong>
<p>This product includes software distributed by Sun (meanwhile Oracle) under CDDL license
(<a href="https://www.sun.com/cddl/cddl.html">https://www.sun.com/cddl/cddl.html</a>).</p>
<p><em> <strong>javax.xml.stream v1.0.1</strong>
<p>This product includes software distributed by Sun (meanwhile Oracle) under CDDL license
(<a href="https://www.sun.com/cddl/cddl.html">https://www.sun.com/cddl/cddl.html</a>).</p>
<p><em> <strong>javax.xml.ws v2.1.0</strong>
<p>This product includes software distributed by Sun (meanwhile Oracle) under CDDL license
(<a href="https://www.sun.com/cddl/cddl.html">https://www.sun.com/cddl/cddl.html</a>).</p>
</em></p>
<address>Copyright (c) 2005, 2011 Spring IDE Developers</address>
</body>
</html>

View File

@@ -0,0 +1,6 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
about.html,\
workspace/

View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot.ide</groupId>
<artifactId>org.springframework.boot.ide</artifactId>
<version>4.8.1-SNAPSHOT</version>
<relativePath>../../eclipse-distribution/pom.xml</relativePath>
</parent>
<groupId>org.springframework.ide.eclipse</groupId>
<artifactId>org.springframework.ide.eclipse.boot.launch.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<useUIHarness>true</useUIHarness>
<forkedProcessTimeoutInSeconds>7200</forkedProcessTimeoutInSeconds>
<testSuite>org.springframework.ide.eclipse.boot.launch.test</testSuite>
<testClass>org.springframework.ide.eclipse.boot.launch.test.AllBootLaunchTests</testClass>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<dependency-resolution>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>org.eclipse.equinox.event</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
<type>eclipse-plugin</type>
<id>org.apache.felix.scr</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
<type>eclipse-feature</type>
<id>org.eclipse.m2e.feature</id>
<versionRange>0.0.0</versionRange>
</requirement>
<!-- <requirement>
<type>eclipse-feature</type>
<id>org.jetbrains.kotlin.feature</id>
<versionRange>0.0.0</versionRange>
</requirement> -->
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,27 @@
/*******************************************************************************
* Copyright (c) 2015 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal Software, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.eclipse.boot.launch.test;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
BootLaunchUIModelTest.class,
ProfileHistoryTest.class,
BootLaunchConfigurationDelegateTest.class,
BootLaunchShortcutTest.class,
BootGroovyScriptLaunchConfigurationDelegateTest.class
})
public class AllBootLaunchTests {
}

View File

@@ -0,0 +1,61 @@
/*******************************************************************************
* Copyright (c) 2013, 2017 GoPivotal, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* GoPivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.eclipse.boot.launch.test;
import static org.springframework.ide.eclipse.boot.launch.cli.BootGroovyScriptLaunchConfigurationDelegate.setScript;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.springframework.ide.eclipse.boot.core.cli.BootInstallManager;
import org.springframework.ide.eclipse.boot.launch.cli.BootGroovyScriptLaunchConfigurationDelegate;
import org.springframework.ide.eclipse.boot.test.util.LaunchResult;
import org.springframework.ide.eclipse.boot.test.util.LaunchUtil;
/**
* @author Kris De Volder
*/
public class BootGroovyScriptLaunchConfigurationDelegateTest extends BootLaunchTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
BootInstallManager.getInstance().getDownloader().allowUIThread(true);
}
private static final String PROJECT_NAME = BootGroovyScriptLaunchConfigurationDelegateTest.class.getSimpleName();
private ILaunchConfigurationWorkingCopy createWorkingCopy() throws CoreException {
return createWorkingCopy(BootGroovyScriptLaunchConfigurationDelegate.ID);
}
public void testLaunchHelloWorld() throws Exception {
IProject p = createGeneralProject(PROJECT_NAME);
createFile(p, "app.groovy",
"@Component\n" +
"class App implements CommandLineRunner {\n" +
" void run(String... args) {\n" +
" sleep(1000)\n" +
" println \"Hello, world!\"\n" +
" }\n" +
"}"
);
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
setScript(wc, p.getFile("app.groovy"));
LaunchResult result = LaunchUtil.synchLaunch(wc);
System.out.println(result); //Great help in debugging this :-)
assertContains("Hello, world", result.out);
assertOk(result);
}
}

View File

@@ -0,0 +1,647 @@
/*******************************************************************************
* Copyright (c) 2015, 2018 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal Software, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.eclipse.boot.launch.test;
import static org.springframework.ide.eclipse.boot.test.BootProjectTestHarness.withImportStrategy;
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;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.JavaLaunchDelegate;
import org.springframework.ide.eclipse.boot.core.BootActivator;
import org.springframework.ide.eclipse.boot.core.BootPreferences;
import org.springframework.ide.eclipse.boot.launch.BootLaunchConfigurationDelegate;
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;
/**
* @author Kris De Volder
*/
@SuppressWarnings("restriction")
public class BootLaunchConfigurationDelegateTest extends BootLaunchTestCase {
private static final String TEST_MAIN_CLASS = "demo.DumpInfoApplication";
private static final String TEST_PROJECT = "dump-info";
@Override
protected void setUp() throws Exception {
super.setUp();
//The following disables some nasty popups that can cause test to hang rather than fail.
//when project has errors upon launching it.
InstanceScope.INSTANCE.getNode(DebugPlugin.getUniqueIdentifier())
.putBoolean(IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, false);
BootActivator.getDefault().getPreferenceStore().setToDefault(BootPreferences.PREF_BOOT_FAST_STARTUP_JVM_ARGS);
BootActivator.getDefault().getPreferenceStore().setToDefault(BootPreferences.PREF_BOOT_FAST_STARTUP_DEFAULT);
}
@SafeVarargs
private static final Properties buildPropewrties(Pair<String, String>... pvs) {
Properties props = new Properties();
for (Pair<String, String> pv : pvs) {
props.setProperty(pv.getKey(), pv.getValue());
}
return props;
}
public void testGetSetProperties() throws Exception {
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
assertEquals("", BootLaunchConfigurationDelegate.getRawApplicationProperties(wc));
BootLaunchConfigurationDelegate.setRawApplicationProperties(wc, null); //accepts null in lieu of empty list,
assertEquals("", BootLaunchConfigurationDelegate.getRawApplicationProperties(wc));
//store one single property
doGetAndSetProps(wc,
"foo=Hello",
buildPropewrties(Pair.of("foo", "Hello"))
);
//store empty property list
doGetAndSetProps(wc,
"",
buildPropewrties()
);
//store a few properties
doGetAndSetProps(wc,
"foo.bar: snuffer.nazz\n" +
"#neala: nolo\n" +
"#Hohoh: Santa Claus",
buildPropewrties(Pair.of("foo.bar", "snuffer.nazz"))
);
//store properties with identical keys
doGetAndSetProps(wc,
"foo=snuffer.nazz\n" +
"#foo=nolo\n" +
"#bar=Santa Claus\n" +
"#bar=Santkkk ",
buildPropewrties(Pair.of("foo", "snuffer.nazz"))
);
}
private ILaunchConfigurationWorkingCopy createWorkingCopy() throws CoreException {
return createWorkingCopy(BootLaunchConfigurationDelegate.TYPE_ID);
}
private void doGetAndSetProps(ILaunchConfigurationWorkingCopy wc, String props, Properties expected) {
BootLaunchConfigurationDelegate.setRawApplicationProperties(wc, props);
Properties retrieved = BootLaunchConfigurationDelegate.getApplicationProperties(wc);
assertEquals(expected, retrieved);
}
public void testSetGetProject() throws Exception {
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
assertEquals(null, BootLaunchConfigurationDelegate.getProject(wc));
IProject project = getProject("foo");
BootLaunchConfigurationDelegate.setProject(wc, project);
assertEquals(project, BootLaunchConfigurationDelegate.getProject(wc));
}
public void testSetGetProfile() throws Exception {
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
assertEquals("", BootLaunchConfigurationDelegate.getProfile(wc));
BootLaunchConfigurationDelegate.setProfile(wc, "deployment");
assertEquals("deployment", BootLaunchConfigurationDelegate.getProfile(wc));
BootLaunchConfigurationDelegate.setProfile(wc, null);
assertEquals("", BootLaunchConfigurationDelegate.getProfile(wc));
}
public void testSetGetAnsiConsoleOutput() throws Exception {
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
boolean ideSupportsAnsiConsoleOutput = BootLaunchConfigurationDelegate.supportsAnsiConsoleOutput();
assertEquals(ideSupportsAnsiConsoleOutput, BootLaunchConfigurationDelegate.getEnableAnsiConsoleOutput(wc));
BootLaunchConfigurationDelegate.setEnableAnsiConsoleOutput(wc, true);
assertEquals(true, BootLaunchConfigurationDelegate.getEnableAnsiConsoleOutput(wc));
BootLaunchConfigurationDelegate.setEnableAnsiConsoleOutput(wc, false);
assertEquals(false, BootLaunchConfigurationDelegate.getEnableAnsiConsoleOutput(wc));
}
public void testSetGetFastStartup() throws Exception {
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
assertEquals(
BootActivator.getDefault().getPreferenceStore()
.getBoolean(BootPreferences.PREF_BOOT_FAST_STARTUP_DEFAULT),
BootLaunchConfigurationDelegate.getFastStartup(wc));
BootLaunchConfigurationDelegate.setFastStartup(wc, true);
assertEquals(true, BootLaunchConfigurationDelegate.getFastStartup(wc));
BootLaunchConfigurationDelegate.setFastStartup(wc, false);
assertEquals(false, BootLaunchConfigurationDelegate.getFastStartup(wc));
}
public void testClearProperties() throws Exception {
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
BootLaunchConfigurationDelegate.setRawApplicationProperties(wc,
"some=thing\n" +
"#some.other=thing"
);
assertFalse(BootLaunchConfigurationDelegate.getApplicationProperties(wc).isEmpty());
BootLaunchConfigurationDelegate.clearProperties(wc);
assertTrue(BootLaunchConfigurationDelegate.getApplicationProperties(wc).isEmpty());
}
public void testGetSetDebug() throws Exception {
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
boolean deflt = BootLaunchConfigurationDelegate.DEFAULT_ENABLE_DEBUG_OUTPUT;
boolean other = !deflt;
assertEquals(deflt,
BootLaunchConfigurationDelegate.getEnableDebugOutput(wc));
BootLaunchConfigurationDelegate.setEnableDebugOutput(wc, other);
assertEquals(other, BootLaunchConfigurationDelegate.getEnableDebugOutput(wc));
BootLaunchConfigurationDelegate.setEnableDebugOutput(wc, deflt);
assertEquals(deflt, BootLaunchConfigurationDelegate.getEnableDebugOutput(wc));
}
public void testGetSetLiveBean() throws Exception {
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
boolean deflt = BootLaunchConfigurationDelegate.DEFAULT_ENABLE_LIVE_BEAN_SUPPORT();
boolean other = !deflt;
assertEquals(deflt, BootLaunchConfigurationDelegate.getEnableLiveBeanSupport(wc));
BootLaunchConfigurationDelegate.setEnableLiveBeanSupport(wc, other);
assertEquals(other, BootLaunchConfigurationDelegate.getEnableLiveBeanSupport(wc));
BootLaunchConfigurationDelegate.setEnableLiveBeanSupport(wc, deflt);
assertEquals(deflt, BootLaunchConfigurationDelegate.getEnableLiveBeanSupport(wc));
}
public void testGetSetJMXPort() throws Exception {
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
assertEquals("", BootLaunchConfigurationDelegate.getJMXPort(wc));
BootLaunchConfigurationDelegate.setJMXPort(wc, "something");
assertEquals("something", BootLaunchConfigurationDelegate.getJMXPort(wc));
}
public void testRunAsLaunch() throws Exception {
IProject project = createLaunchReadyProject(TEST_PROJECT);
//Creates a launch conf similar to that created by 'Run As' menu.
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
BootLaunchConfigurationDelegate.setDefaults(wc, project, TEST_MAIN_CLASS);
LaunchResult result = LaunchUtil.synchLaunch(wc);
System.out.println(result); //Great help in debugging this :-)
assertContains(":: Spring Boot ::", result.out);
assertOk(result);
}
public void testLaunchAllOptsDisable() throws Exception {
createLaunchReadyProject(TEST_PROJECT);
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();
LaunchResult result = LaunchUtil.synchLaunch(wc);
assertContains(":: Spring Boot ::", result.out);
assertOk(result);
}
public void testLaunchWithDebugOutput() throws Exception {
createLaunchReadyProject(TEST_PROJECT);
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();
BootLaunchConfigurationDelegate.setEnableDebugOutput(wc, true);
LaunchResult result = LaunchUtil.synchLaunch(wc);
assertContains(":: Spring Boot ::", result.out);
assertContains("AUTO-CONFIGURATION REPORT", result.out);
assertOk(result);
}
public void testLaunchWithLiveBeans() throws Exception {
createLaunchReadyProject(TEST_PROJECT);
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();
BootLaunchConfigurationDelegate.setEnableLiveBeanSupport(wc, true);
int port = JmxBeanSupport.randomPort();
BootLaunchConfigurationDelegate.setJMXPort(wc, ""+port);
LaunchResult result = LaunchUtil.synchLaunch(wc);
System.out.println(result);
assertContains(":: Spring Boot ::", result.out);
//The following check doesn't real prove the live bean graph works, but at least it shows the VM args are
//taking effect.
assertContains("com.sun.management.jmxremote.port='"+port+"'", result.out);
assertOk(result);
}
public void testLaunchWithProperties() throws Exception {
createLaunchReadyProject(TEST_PROJECT);
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();
BootLaunchConfigurationDelegate.setRawApplicationProperties(wc,
"foo=foo is enabled\n" +
"#bar=bar is not enabled\n" +
"zor=zor enabled\n" +
"#zor=zor disabled"
);
int jmxPort = JmxBeanSupport.randomPort(); // must set or it will be generated randomly
// and then we can't make the 'assert' below pass easily.
BootLaunchConfigurationDelegate.setJMXPort(wc, ""+jmxPort);
LaunchResult result = LaunchUtil.synchLaunch(wc);
assertContains(":: Spring Boot ::", result.out);
assertPropertyDump(result.out,
"debug=null\n" +
"zor='zor enabled'\n" +
"foo='foo is enabled'\n" +
"bar=null\n" +
"com.sun.management.jmxremote.port='"+jmxPort+"'"
);
assertOk(result);
}
public void testLaunchWithEmptyProperties() throws Exception {
createLaunchReadyProject(TEST_PROJECT);
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();
BootLaunchConfigurationDelegate.setRawApplicationProperties(wc,
"foo=\n" +
"#bar=bar is not enabled\n"
);
int jmxPort = JmxBeanSupport.randomPort(); // must set or it will be generated randomly
// and then we can't make the 'assert' below pass easily.
BootLaunchConfigurationDelegate.setJMXPort(wc, ""+jmxPort);
LaunchResult result = LaunchUtil.synchLaunch(wc);
assertContains(":: Spring Boot ::", result.out);
assertPropertyDump(result.out,
"debug=null\n" +
"zor=null\n" +
"foo=''\n" +
"bar=null\n" +
"com.sun.management.jmxremote.port='"+jmxPort+"'"
);
assertOk(result);
}
public void testLaunchWithProfile() throws Exception {
createLaunchReadyProject(TEST_PROJECT);
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();
BootLaunchConfigurationDelegate.setProfile(wc, "special");
LaunchResult result = LaunchUtil.synchLaunch(wc);
assertContains(":: Spring Boot ::", result.out);
assertContains("foo='special foo'", result.out);
assertOk(result);
}
public void testLaunchWithThinWrapper() throws Exception {
BootProcessFactory.ENABLE_OUTPUT_DUMPING = true;
try {
URL thinWrapperUrl = new URL("https://repo1.maven.org/maven2/org/springframework/boot/experimental/spring-boot-thin-wrapper/1.0.9.RELEASE/spring-boot-thin-wrapper-1.0.9.RELEASE.jar");
File thinWrapper = File.createTempFile("thin-wrapper", ".jar");
try {
FileUtils.copyURLToFile(thinWrapperUrl, thinWrapper);
BootPreferences.getInstance().setThinWrapper(thinWrapper);
doThinWrapperLaunchTest(thinWrapper, "MAVEN");
//Not working: doThinWrapperLaunchTest(thinWrapper, "GRADLE");
} finally {
FileUtils.deleteQuietly(thinWrapper);
BootPreferences.getInstance().setThinWrapper(null);
}
} finally {
BootProcessFactory.ENABLE_OUTPUT_DUMPING = false;
}
}
private void doThinWrapperLaunchTest(File thinWrapper, String importStrategy) throws Exception {
System.out.println(">>> doThinWrapperLaunchTest: "+importStrategy);
try {
boolean reallyDoThinLaunch = true;
Timewatch.monitor("Thin launch with "+importStrategy, Duration.ofMinutes(5), () -> {
String buildType = importStrategy.split("\\-")[0].toLowerCase();
IProject project = projects.createBootProject("thinly-wrapped-"+buildType, withImportStrategy(importStrategy));
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy(project.getName(), "com.example.demo.ThinlyWrapped"+ StringUtils.capitalize(buildType) +"Application");
createFile(project, "src/main/java/com/example/demo/ShowMessage.java",
"package com.example.demo;\n" +
"\n" +
"import org.springframework.boot.CommandLineRunner;\n" +
"import org.springframework.stereotype.Component;\n" +
"\n" +
"@Component\n" +
"public class ShowMessage implements CommandLineRunner {\n" +
"\n" +
" @Override\n" +
" public void run(String... arg0) throws Exception {\n" +
" System.out.println(\"We have liftoff!\");\n" +
" }\n" +
"\n" +
"}\n"
);
StsTestUtil.assertNoErrors(project); // compile project (and check for errors)
if (buildType.equals("maven")) {
//In gradle its different location, but doens't really matter, this just a 'sanity' check to
// see if class got compiled. If not, something else will fail later.
assertTrue(project.getFile("target/classes/com/example/demo/ShowMessage.class").exists());
}
if (reallyDoThinLaunch) {
BootLaunchConfigurationDelegate.setUseThinWrapper(wc, true);
String[] classpath = getClasspath(new BootLaunchConfigurationDelegate(), wc);
assertTrue(classpath.length==1);
assertEquals(thinWrapper.getAbsolutePath(), classpath[0]);
}
LaunchResult result = LaunchUtil.synchLaunch(wc);
System.out.println(result);
assertContains("We have liftoff!", result.out);
});
} finally {
System.out.println("<<< doThinWrapperLaunchTest: "+importStrategy);
}
}
/**
* Name fragments that, when seen in a dependency, probably mean the dependency is a test dependency
*/
private static final String[] testFragments = {
"test",
"junit",
"assertj",
"mockito",
};
private static boolean isTestClasspathEntry(String cpe) {
for (String testFrag : testFragments) {
String normalizedEntry = cpe.replace('\\', '/');
int slash = normalizedEntry.lastIndexOf('/');
if (slash>=0) {
normalizedEntry = normalizedEntry.substring(slash);
}
if (normalizedEntry.contains(testFrag)) {
return true;
}
}
return false;
}
public void testRuntimeClasspathNoTestStuffGradle() throws Exception {
IProject project = projects.createBootProject("gradle-test-project", withImportStrategy("GRADLE"));
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy(project.getName(), "com.example.demo.GradleTestProjectApplication");
String[] cp = getClasspath(new BootLaunchConfigurationDelegate(), wc);
ArrayList<String> testDependencies = new ArrayList<>();
for (String cpe : cp) {
if (isTestClasspathEntry(cpe)) {
testDependencies.add(cpe);
}
}
if (!testDependencies.isEmpty()) {
fail("Shouldn't have test dependencies but found: "+testDependencies);
}
}
public void testRuntimeClasspathNoTestStuff() throws Exception {
createLaunchReadyProject(TEST_PROJECT);
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();
String[] cp = getClasspath(new BootLaunchConfigurationDelegate(), wc);
assertClasspath(cp,
//ignore:
(s) -> s.contains("/jre/lib/") || s.contains("/Java/Extensions/"),
//expect:
"target/classes",
"spring-boot-starter-1.2.1.RELEASE.jar",
"spring-boot-1.2.1.RELEASE.jar",
"spring-context-4.1.4.RELEASE.jar",
"spring-aop-4.1.4.RELEASE.jar",
"aopalliance-1.0.jar",
"spring-beans-4.1.4.RELEASE.jar",
"spring-expression-4.1.4.RELEASE.jar",
"spring-boot-autoconfigure-1.2.1.RELEASE.jar",
"spring-boot-starter-logging-1.2.1.RELEASE.jar",
"jcl-over-slf4j-1.7.8.jar",
"slf4j-api-1.7.8.jar",
"jul-to-slf4j-1.7.8.jar",
"log4j-over-slf4j-1.7.8.jar",
"logback-classic-1.1.2.jar",
"logback-core-1.1.2.jar",
"spring-core-4.1.4.RELEASE.jar",
"snakeyaml-1.14.jar"
);
}
private static void assertClasspath(String[] _cp, Predicate<String> ignoring, String... expected) {
List<String> cpList = new ArrayList<String>(_cp.length);
for (int i = 0; i < _cp.length; i++) {
String normalizedEntry = _cp[i].replace('\\', '/');
if (!ignoring.test(normalizedEntry)) {
cpList.add(normalizedEntry);
}
}
String[] cp = cpList.toArray(new String[cpList.size()]);
for (String e : expected) {
assertClasspathHasEntry(cp, e);
}
for (String e : cp) {
assertClasspathEntryExpected(e, expected);
}
}
private static void assertClasspathEntryExpected(String e, String[] expected) {
for (String expect : expected) {
if (e.endsWith(expect)) {
return;
}
}
fail("Unexpected classpath entry: "+e);
}
private static void assertClasspathHasEntry(String[] cp, String expect) {
StringBuilder found = new StringBuilder();
for (String actual : cp) {
found.append(actual+"\n");
if (actual.endsWith(expect)) {
return;
}
}
fail("Missing classpath entry: "+expect+"\n"
+ "found: "+found);
}
private String[] getClasspath(JavaLaunchDelegate delegate,
ILaunchConfigurationWorkingCopy wc) throws CoreException {
System.out.println("\n====classpath according to "+delegate.getClass().getSimpleName());
String[][] cpAndMp = delegate.getClasspathAndModulepath(wc);
String[] classpath = cpAndMp[0];
for (String element : classpath) {
int chop = element.lastIndexOf('/');
System.out.println('"'+element.substring(chop+1)+"\",");
}
return classpath;
}
private void assertPropertyDump(String out, String expected) {
String BEG = ">>>properties";
String END = "<<<properties";
int beg = out.indexOf(BEG)+BEG.length();
int end = out.indexOf(END);
String found = out.substring(beg, end);
assertEquals(windozify(expected), windozify(found));
}
/**
* Normalize crlf to just single newline for windoze's sake.
*/
private String windozify(String text) {
text = text.trim();
return text.replaceAll("\r", "");
}
private ILaunchConfigurationWorkingCopy createBaseWorkingCopy() throws Exception {
return createBaseWorkingCopy(TEST_PROJECT, TEST_MAIN_CLASS);
}
private ILaunchConfigurationWorkingCopy createBaseWorkingCopy(String testProjectName, String testMainClass) throws Exception {
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
BootLaunchConfigurationDelegate.setDefaults(wc, getProject(testProjectName), testMainClass);
//Explictly set all options in the config to 'disabled' irrespective of
// their default values (tests will be more robust w.r.t changing of the defaults).
BootLaunchConfigurationDelegate.setEnableDebugOutput(wc, false);
BootLaunchConfigurationDelegate.setEnableLiveBeanSupport(wc, false);
BootLaunchConfigurationDelegate.setJMXPort(wc, "");
BootLaunchConfigurationDelegate.setProfile(wc, "");
BootLaunchConfigurationDelegate.setRawApplicationProperties(wc, "");
return wc;
}
///////////////////////////////////////////////////////////////////////////////
public void testFastStartupNoVmArgs() throws Exception {
createLaunchReadyProject(TEST_PROJECT);
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();
BootLaunchConfigurationDelegate.setFastStartup(wc, true);
// Disable life-cycle vm args just to test VM args for fast startup
BootLaunchConfigurationDelegate.setEnableLifeCycle(wc, false);
BootLaunchConfigurationDelegate.setEnableLiveBeanSupport(wc, false);
BootLaunchConfigurationDelegate.setEnableJMX(wc, false);
String fastStartupArgs = BootActivator.getDefault().getPreferenceStore().getDefaultString(BootPreferences.PREF_BOOT_FAST_STARTUP_JVM_ARGS);
assertTrue(!fastStartupArgs.trim().isEmpty());
String vmArgs = new BootLaunchConfigurationDelegate().getVMArguments(wc);
assertContains(" " + fastStartupArgs+" ", vmArgs);
LaunchResult result = LaunchUtil.synchLaunch(wc);
assertOk(result);
}
public void testFastStartupCustomVmArgs() throws Exception {
createLaunchReadyProject(TEST_PROJECT);
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();
BootLaunchConfigurationDelegate.setFastStartup(wc, true);
// Disable life-cycle vm args just to test VM args for fast startup
BootLaunchConfigurationDelegate.setEnableLifeCycle(wc, false);
BootLaunchConfigurationDelegate.setEnableLiveBeanSupport(wc, false);
BootLaunchConfigurationDelegate.setEnableJMX(wc, false);
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "-Xmx1024M");
String fastStartupArgs = BootActivator.getDefault().getPreferenceStore().getDefaultString(BootPreferences.PREF_BOOT_FAST_STARTUP_JVM_ARGS);
assertTrue(!fastStartupArgs.trim().isEmpty());
String vmArgs = new BootLaunchConfigurationDelegate().getVMArguments(wc);
assertEquals("-Xmx1024M " + fastStartupArgs+" -Dspring.boot.project.name=dump-info", vmArgs);
// Also try live beans/JMX arguments
BootLaunchConfigurationDelegate.setEnableLifeCycle(wc, true);
BootLaunchConfigurationDelegate.setEnableLiveBeanSupport(wc, true);
BootLaunchConfigurationDelegate.setEnableJMX(wc, true);
LaunchResult result = LaunchUtil.synchLaunch(wc);
assertOk(result);
}
public void testProjectWithSpaces() throws Exception {
createLaunchReadyProject("project with spaces");
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy("project with spaces", TEST_MAIN_CLASS);
String actualArgsStr = new BootLaunchConfigurationDelegate().getVMArguments(wc);
String[] acutalArgs = DebugPlugin.parseArguments(actualArgsStr);
boolean found = false;
final String prefix = "-Dspring.boot.project.name=";
for (String string : acutalArgs) {
if (string.startsWith(prefix)) {
String value = string.substring(prefix.length());
assertEquals("project with spaces", value);
found = true;
}
}
assertTrue("Did not find expected vmargument "+prefix, found);
}
public void testEmptyFastStartupVmArgs() throws Exception {
createLaunchReadyProject(TEST_PROJECT);
ILaunchConfigurationWorkingCopy wc = createBaseWorkingCopy();
BootLaunchConfigurationDelegate.setFastStartup(wc, true);
// Disable life-cycle vm args just to test VM args for fast startup
BootLaunchConfigurationDelegate.setEnableLifeCycle(wc, false);
BootLaunchConfigurationDelegate.setEnableLiveBeanSupport(wc, false);
BootLaunchConfigurationDelegate.setEnableJMX(wc, false);
String vmArgs = "-Xmx1024M";
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs);
BootActivator.getDefault().getPreferenceStore().setValue(BootPreferences.PREF_BOOT_FAST_STARTUP_JVM_ARGS, " \t ");
String fastStartupArgs = BootActivator.getDefault().getPreferenceStore().getString(BootPreferences.PREF_BOOT_FAST_STARTUP_JVM_ARGS);
assertTrue(!fastStartupArgs.isEmpty() && fastStartupArgs.trim().isEmpty());
String actualArgs = new BootLaunchConfigurationDelegate().getVMArguments(wc);
assertEquals(vmArgs+" -Dspring.boot.project.name="+TEST_PROJECT, actualArgs);
LaunchResult result = LaunchUtil.synchLaunch(wc);
assertOk(result);
}
}

View File

@@ -0,0 +1,190 @@
/*******************************************************************************
* Copyright (c) 2015, 2018 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal Software, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.eclipse.boot.launch.test;
import static org.springframework.ide.eclipse.boot.launch.AbstractBootLaunchConfigurationDelegate.DEFAULT_ENABLE_DEBUG_OUTPUT;
import static org.springframework.ide.eclipse.boot.launch.AbstractBootLaunchConfigurationDelegate.getEnableDebugOutput;
import static org.springframework.ide.eclipse.boot.launch.AbstractBootLaunchConfigurationDelegate.getRawApplicationProperties;
import static org.springframework.ide.eclipse.boot.launch.BootLaunchConfigurationDelegate.DEFAULT_ENABLE_LIVE_BEAN_SUPPORT;
import static org.springframework.ide.eclipse.boot.launch.BootLaunchConfigurationDelegate.getEnableLiveBeanSupport;
import static org.springframework.ide.eclipse.boot.launch.BootLaunchConfigurationDelegate.getJMXPort;
import static org.springframework.ide.eclipse.boot.launch.BootLaunchConfigurationDelegate.getProfile;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.ui.PlatformUI;
import org.springframework.ide.eclipse.boot.launch.BootLaunchConfigurationDelegate;
import org.springframework.ide.eclipse.boot.launch.BootLaunchShortcut;
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;
/**
* @author Kris De Volder
*/
public class BootLaunchShortcutTest extends BootLaunchTestCase {
private static final String ALT_MAIN_TYPE = "demo.AlternateMain";
private static final String PROJECT = "empty-boot-project";
private static final String MAIN_TYPE = "demo.EmptyBootProjectApplication";
protected BootLaunchShortcut shortcut = new BootLaunchShortcut();
private IRunnableContext testContext = PlatformUI.getWorkbench().getProgressService();
@Override
protected void tearDown() throws Exception {
super.tearDown();
ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
ILaunch[] launches = lm.getLaunches();
if (launches!=null) {
lm.removeLaunches(lm.getLaunches());
}
}
public void testProjectFindTypes() throws Exception {
IProject project = createLaunchReadyProject(PROJECT);
assertElements(findTypes(project), //something
MAIN_TYPE
);
}
public void testJavaProjectFindTypes() throws Exception {
IJavaProject project = JavaCore.create(createLaunchReadyProject(PROJECT));
assertElements(findTypes(project), //something
MAIN_TYPE
);
}
//Ignore because fails regularly in CI builds. Not sure why, probably something around provisioning the kotlin support in the test runtime.
public void IGNORE_testKotlinProjectFindTypes() throws Exception {
final IJavaProject project = createLaunchReadyKotlinProject("kotlin-bootapp");
ACondition.waitFor("Wait for kotlin main type", 20_000, () -> {
assertElements(findTypes(project), //something
"com.example.demo.KotlinBootappApplicationKt"
);
});
}
public void testMainClassFindTypes() throws Exception {
IJavaProject project = JavaCore.create(createLaunchReadyProject(PROJECT));
IType target = project.findType(ALT_MAIN_TYPE);
assertElements(findTypes(target),
ALT_MAIN_TYPE
);
}
public void testMainMethodFindTypes() throws Exception {
IJavaProject project = JavaCore.create(createLaunchReadyProject(PROJECT));
IMethod target = getMainMethod(project.findType(ALT_MAIN_TYPE));
assertElements(findTypes(target),
ALT_MAIN_TYPE
);
}
public void testMainClassSourceFileFindTypes() throws Exception {
IJavaProject project = JavaCore.create(createLaunchReadyProject(PROJECT));
IResource target = project.findType(ALT_MAIN_TYPE).getUnderlyingResource();
assertElements(findTypes(target),
ALT_MAIN_TYPE
);
}
public void testMainClassCompilationUnitFindTypes() throws Exception {
IJavaProject project = JavaCore.create(createLaunchReadyProject(PROJECT));
ICompilationUnit target = JavaCore.createCompilationUnitFrom(
(IFile) project.findType(ALT_MAIN_TYPE).getUnderlyingResource());
assertElements(findTypes(target),
ALT_MAIN_TYPE
);
}
public void testCreateConfiguration() throws Exception {
IJavaProject project = JavaCore.create(createLaunchReadyProject(PROJECT));
IType mainType = project.findType(MAIN_TYPE);
ILaunchConfiguration conf = shortcut.createConfiguration(mainType);
assertEquals(getProject(PROJECT), BootLaunchConfigurationDelegate.getProject(conf));
assertEquals(MAIN_TYPE,
conf.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, ""));
assertEquals("", getProfile(conf));
assertEquals(DEFAULT_ENABLE_DEBUG_OUTPUT, getEnableDebugOutput(conf));
assertEquals(DEFAULT_ENABLE_LIVE_BEAN_SUPPORT(), getEnableLiveBeanSupport(conf));
int port = Integer.parseInt(getJMXPort(conf));
assertEquals(0, port); // 0 means 'allocate dynamically'
assertEquals("", getRawApplicationProperties(conf));
}
public void testConfigurationDeletedWhenProjectDeleted() throws Exception {
IJavaProject project = JavaCore.create(createLaunchReadyProject(PROJECT));
IType mainType = project.findType(MAIN_TYPE);
final ILaunchConfiguration conf = shortcut.createConfiguration(mainType);
assertTrue(conf.exists());
project.getProject().delete(true, true, new NullProgressMonitor());
//The delete fo launch conf happens in response to project delete, but
// its in a job so we don't know exactly when it will be done... so...
new ACondition() {
@Override
public boolean test() throws Exception {
assertFalse(conf.exists());
return true;
}
}.waitFor(5000);
}
public void testLaunch() throws Exception {
IJavaProject project = JavaCore.create(createLaunchReadyProject(PROJECT));
IType mainType = project.findType(MAIN_TYPE);
ILaunchConfiguration conf = shortcut.createConfiguration(mainType);
LaunchResult r = LaunchUtil.synchLaunch(conf);
assertContains(":: Spring Boot ::", r.out);
assertOk(r);
}
////////////////////////////////////////////////////////////////
private IMethod getMainMethod(IType type) throws Exception {
for (IMethod m : type.getMethods()) {
if ("main".equals(m.getElementName())) {
return m;
}
}
throw new Error("No main method in "+type);
}
public String[] findTypes(Object selection) throws InterruptedException, CoreException {
IType[] types = shortcut.findTypes(new Object[] {selection}, testContext);
if (types!=null && types.length>0) {
String[] names = new String[types.length];
for (int i = 0; i < names.length; i++) {
names[i] = types[i].getFullyQualifiedName();
}
return names;
}
return new String[0];
}
}

View File

@@ -0,0 +1,108 @@
/*******************************************************************************
* Copyright (c) 2015 Pivotal, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.eclipse.boot.launch.test;
import static org.springframework.ide.eclipse.boot.test.BootProjectTestHarness.withLanguage;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.springframework.ide.eclipse.boot.test.BootProjectTestHarness;
import org.springframework.ide.eclipse.boot.test.util.LaunchResult;
import org.springsource.ide.eclipse.commons.livexp.core.LiveExpression;
import org.springsource.ide.eclipse.commons.livexp.core.LiveVariable;
import org.springsource.ide.eclipse.commons.livexp.core.ValidationResult;
import org.springsource.ide.eclipse.commons.tests.util.StsTestCase;
import org.springsource.ide.eclipse.commons.tests.util.StsTestUtil;
/**
* @author Kris De Volder
*/
public class BootLaunchTestCase extends StsTestCase {
protected BootProjectTestHarness projects = new BootProjectTestHarness(ResourcesPlugin.getWorkspace());
/**
* Create an empty project no nature, no nothing
*/
public static IProject createGeneralProject(String name) throws Exception {
IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
p.create(new NullProgressMonitor());
p.open(new NullProgressMonitor());
assertTrue(p.exists());
assertTrue(p.isAccessible());
return p;
}
public static void assertOk(LaunchResult result) {
assertEquals(0, result.terminationCode);
}
@Override
protected String getBundleName() {
return "org.springframework.ide.eclipse.boot.launch.test";
}
protected ILaunchConfigurationWorkingCopy createWorkingCopy(String launchConfTypeId) throws CoreException {
String name = DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName("test");
ILaunchConfigurationWorkingCopy wc = DebugPlugin.getDefault().getLaunchManager()
.getLaunchConfigurationType(launchConfTypeId)
.newInstance(null, name);
return wc;
}
public IProject getProject(String name) {
return ResourcesPlugin.getWorkspace().getRoot().getProject(name);
}
public void assertError(String snippet, LiveExpression<ValidationResult> validator) {
ValidationResult value = validator.getValue();
assertEquals(IStatus.ERROR, value.status);
assertContains(snippet, value.msg);
}
public static void assertOk(LiveExpression<ValidationResult> validator) {
ValidationResult status = validator.getValue();
if (!status.isOk()) {
fail(status.toString());
}
}
/**
* Tests that want to launch something from a project should use this rather to
* make sure project is built and has no errors.
* <p>
* Projects with errors shouldn't be launched as they will just cause launcher tests to
* fail in confusing and unpredictabled ways.
*/
public IProject createLaunchReadyProject(String projectName) throws Exception {
IProject project = createPredefinedProject(projectName);
StsTestUtil.assertNoErrors(project);
return project;
}
public IJavaProject createLaunchReadyKotlinProject(final String projectName) throws Exception {
return JavaCore.create(projects.createBootWebProject(projectName, withLanguage("kotlin")));
}
}

View File

@@ -0,0 +1,564 @@
/*******************************************************************************
* Copyright (c) 2015 Pivotal, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.eclipse.boot.launch.test;
import static org.junit.Assert.assertArrayEquals;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.springframework.ide.eclipse.boot.launch.BootLaunchActivator;
import org.springframework.ide.eclipse.boot.launch.BootLaunchConfigurationDelegate;
import org.springframework.ide.eclipse.boot.launch.BootLaunchUIModel;
import org.springframework.ide.eclipse.boot.launch.IProfileHistory;
import org.springframework.ide.eclipse.boot.launch.LaunchTabSelectionModel;
import org.springframework.ide.eclipse.boot.launch.MainTypeNameLaunchTabModel;
import org.springframework.ide.eclipse.boot.launch.ProfileLaunchTabModel;
import org.springframework.ide.eclipse.boot.launch.SelectProjectLaunchTabModel;
import org.springframework.ide.eclipse.boot.launch.livebean.EnableJmxFeaturesModel;
import org.springsource.ide.eclipse.commons.livexp.core.LiveExpression;
import org.springsource.ide.eclipse.commons.livexp.core.LiveVariable;
import org.springsource.ide.eclipse.commons.livexp.core.ValidationResult;
import org.springsource.ide.eclipse.commons.livexp.core.Validator;
/**
* @author Kris De Volder
*/
public class BootLaunchUIModelTest extends BootLaunchTestCase {
private static final String[] NO_PROFILES = new String[0];
public class TestProfileHistory implements IProfileHistory {
private Map<String, String[]> map = new HashMap<>();
@Override
public String[] getHistory(IProject project) {
String[] h = map.get(project.getName());
if (h!=null) {
return h;
}
return NO_PROFILES;
}
public void setHistory(IProject p, String... history) {
map.put(p.getName(), history);
}
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
protected BootLaunchUIModel model;
protected TestProfileHistory profileHistory;
@Override
protected void setUp() throws Exception {
super.setUp();
profileHistory = new TestProfileHistory();
model = new BootLaunchUIModel(profileHistory);
}
///// project ////////////////////////////////////////////////////////////
public void testProjectValidator() throws Exception {
createPredefinedProject("empty-boot-project");
createGeneralProject("general");
assertError("No project selected", model.project.validator);
model.project.selection.setValue(getProject("non-existant"));
assertError("does not exist", model.project.validator);
model.project.selection.setValue(getProject("general"));
assertError("does not look like a Boot project", model.project.validator);
model.project.selection.setValue(getProject("empty-boot-project"));
assertOk(model.project.validator);
getProject("empty-boot-project").close(new NullProgressMonitor());
model.project.validator.refresh(); //manual refresh is needed
// no auto refresh when closing project. This is normal
// and it is okay since user can't open/close projects
// while using launch config dialog.
assertError("is closed", model.project.validator);
}
private ILaunchConfigurationWorkingCopy createWorkingCopy() throws CoreException {
return createWorkingCopy(BootLaunchConfigurationDelegate.TYPE_ID);
}
public void testProjectInitializeFrom() throws Exception {
IProject fooProject = getProject("foo");
SelectProjectLaunchTabModel project = model.project;
LiveVariable<Boolean> dirtyState = model.project.getDirtyState();
dirtyState.setValue(false);
project.selection.setValue(fooProject);
assertTrue(dirtyState.getValue());
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
project.initializeFrom(wc);
assertEquals(null, project.selection.getValue());
assertFalse(dirtyState.getValue());
BootLaunchConfigurationDelegate.setProject(wc, fooProject);
project.initializeFrom(wc);
assertEquals(fooProject, project.selection.getValue());
}
public void testProjectPerformApply() throws Exception {
IProject fooProject = getProject("foo");
SelectProjectLaunchTabModel project = model.project;
LiveVariable<Boolean> dirtyState = model.project.getDirtyState();
dirtyState.setValue(false);
project.selection.setValue(fooProject);
assertTrue(dirtyState.getValue());
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
assertEquals(null, BootLaunchConfigurationDelegate.getProject(wc));
project.performApply(wc);
assertFalse(dirtyState.getValue());
assertEquals(fooProject, BootLaunchConfigurationDelegate.getProject(wc));
}
public void testProjectSetDefaults() throws Exception {
IProject fooProject = getProject("foo");
SelectProjectLaunchTabModel project = model.project;
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
BootLaunchConfigurationDelegate.setProject(wc, fooProject);
assertEquals(fooProject, BootLaunchConfigurationDelegate.getProject(wc));
project.setDefaults(wc);
assertEquals(null, BootLaunchConfigurationDelegate.getProject(wc));
}
public void testProjectDirtyState() throws Exception {
SelectProjectLaunchTabModel project = model.project;
LiveVariable<Boolean> dirtyState = model.project.getDirtyState();
dirtyState.setValue(false);
project.selection.setValue(getProject("nono"));
assertTrue(dirtyState.getValue());
}
////// main type //////////////////////////////////////////////////////////
public void testMainTypeValidator() throws Exception {
assertEquals("", model.mainTypeName.selection.getValue());
assertError("No Main type selected", model.mainTypeName.validator);
model.mainTypeName.selection.setValue("something");
assertOk(model.mainTypeName.validator);
}
public void testMainTypeInitializeFrom() throws Exception {
MainTypeNameLaunchTabModel mainTypeName = model.mainTypeName;
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
LiveVariable<Boolean> dirtyState = model.mainTypeName.getDirtyState();
BootLaunchConfigurationDelegate.setMainType(wc, "Snuggem");
dirtyState.setValue(true);
mainTypeName.initializeFrom(wc);
assertFalse(dirtyState.getValue());
assertEquals("Snuggem", mainTypeName.selection.getValue());
}
public void testMainTypePerformApply() throws Exception {
MainTypeNameLaunchTabModel mainTypeName = model.mainTypeName;
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
LiveVariable<Boolean> dirtyState = model.mainTypeName.getDirtyState();
mainTypeName.selection.setValue("Koko");
assertTrue(dirtyState.getValue());
mainTypeName.performApply(wc);
assertEquals("Koko", getMainTypeName(wc));
assertFalse(dirtyState.getValue());
}
public void testMainTypeSetDefaults() throws Exception {
MainTypeNameLaunchTabModel mainTypeName = model.mainTypeName;
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
mainTypeName.setDefaults(wc);
assertEquals("", getMainTypeName(wc));
}
protected String getMainTypeName(ILaunchConfigurationWorkingCopy wc)
throws CoreException {
return wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, (String)null);
}
public void testMainTypeDirtyState() throws Exception {
MainTypeNameLaunchTabModel mainTypeName = model.mainTypeName;
LiveVariable<Boolean> dirtyState = model.mainTypeName.getDirtyState();
dirtyState.setValue(false);
mainTypeName.selection.setValue("something");
assertTrue(dirtyState.getValue());
}
////// profile ////////////////////////////////////////////////////////////////////
public void testProfileValidator() throws Exception {
assertEquals(Validator.OK, model.profile.validator);
//not much to test here, we don't validate profiles at all.
}
public void testProfileSetDefaults() throws Exception {
ProfileLaunchTabModel profile = model.profile;
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
profile.setDefaults(wc);
assertEquals("", BootLaunchConfigurationDelegate.getProfile(wc));
}
public void testProfileInitializeFrom() throws Exception {
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
ProfileLaunchTabModel profile = model.profile;
LiveVariable<Boolean> dirty = profile.getDirtyState();
dirty.setValue(true);
BootLaunchConfigurationDelegate.setProfile(wc,"some-profile");
profile.initializeFrom(wc);
assertFalse(dirty.getValue());
assertEquals("some-profile", BootLaunchConfigurationDelegate.getProfile(wc));
}
public void testProfilePerformApply() throws Exception {
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
ProfileLaunchTabModel profile = model.profile;
LiveVariable<Boolean> dirty = profile.getDirtyState();
profile.selection.setValue("some-other-profile");
assertTrue(dirty.getValue());
profile.performApply(wc);
assertFalse(dirty.getValue());
assertEquals("some-other-profile", BootLaunchConfigurationDelegate.getProfile(wc));
}
public void testProfileDirtyState() throws Exception {
ProfileLaunchTabModel profile = model.profile;
LiveVariable<Boolean> dirty = profile.getDirtyState();
dirty.setValue(false);
profile.selection.setValue("olla-polla");
assertTrue(dirty.getValue());
}
public void testProfilePulldownOptions() throws Exception {
IProject bootProject = createPredefinedProject("empty-boot-project");
IProject generalProject = createGeneralProject("general");
LiveVariable<IProject> project = model.project.selection;
ProfileLaunchTabModel profile = model.profile;
assertPulldown(profile /*empty*/);
createEmptyFile(bootProject, "src/main/resources/application-foo.properties");
createEmptyFile(bootProject, "src/main/resources/application-bar.properties");
project.setValue(bootProject);
assertPulldown(profile, "foo", "bar");
project.setValue(getProject("invalid"));
assertPulldown(profile /*empty*/);
profileHistory.setHistory(generalProject, "something", "borker");
project.setValue(generalProject);
assertPulldown(profile, "something", "borker");
profileHistory.setHistory(bootProject, "old", "older");
project.setValue(bootProject);
assertPulldown(profile, "foo", "bar", "old", "older");
profileHistory.setHistory(bootProject, "new", "newer", "foo");
profile.profileOptions().refresh(); // See [*] below
assertPulldown(profile, "foo", "bar", "new", "newer"); //only a single 'foo'!
// [*] Changing only the history doesn't trigger pull-down options to recompute.
//This is fine since its not possible to change the history while launch dialog is open.
//However, it means test code must force a refresh in cases where only the history
//changed.
}
///// EnableDebugSection///////////////////////////////////////////////////////
public void testDebugValidator() throws Exception {
assertEquals(Validator.OK, model.enableDebug.validator);
}
public void testDebugSetDefaults() throws Exception {
LaunchTabSelectionModel<Boolean> enableDebug = model.enableDebug;
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
enableDebug.setDefaults(wc);
assertEquals(false, BootLaunchConfigurationDelegate.getEnableDebugOutput(wc));
}
public void testDebugInitializeFrom() throws Exception {
LaunchTabSelectionModel<Boolean> enableDebug = model.enableDebug;
LiveVariable<Boolean> dirty = enableDebug.getDirtyState();
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
BootLaunchConfigurationDelegate.setEnableDebugOutput(wc, true);
dirty.setValue(true);
enableDebug.initializeFrom(wc);
assertFalse(dirty.getValue());
assertTrue(enableDebug.selection.getValue());
dirty.setValue(true);
BootLaunchConfigurationDelegate.setEnableDebugOutput(wc, false);
enableDebug.initializeFrom(wc);
assertFalse(dirty.getValue());
assertFalse(enableDebug.selection.getValue());
}
public void testDebugPerformApply() throws Exception {
LaunchTabSelectionModel<Boolean> enableDebug = model.enableDebug;
LiveVariable<Boolean> dirty = enableDebug.getDirtyState();
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
enableDebug.selection.setValue(true);
assertTrue(dirty.getValue());
enableDebug.performApply(wc);
assertFalse(dirty.getValue());
assertTrue(BootLaunchConfigurationDelegate.getEnableDebugOutput(wc));
enableDebug.selection.setValue(false);
assertTrue(dirty.getValue());
enableDebug.performApply(wc);
assertFalse(dirty.getValue());
assertFalse(BootLaunchConfigurationDelegate.getEnableDebugOutput(wc));
}
public void testDebugDirtyState() throws Exception {
LaunchTabSelectionModel<Boolean> enableDebug = model.enableDebug;
LiveVariable<Boolean> dirty = enableDebug.getDirtyState();
dirty.setValue(false);
enableDebug.selection.setValue(true);
assertTrue(dirty.getValue());
}
///// EnableJmxSectiom /////////////////////////////////////////////
public void testJmxValidator() throws Exception {
EnableJmxFeaturesModel eJmxModel = this.model.enableJmx;
LiveVariable<Boolean> jmx = eJmxModel.jmxEnabled;
LiveVariable<Boolean> liveBean = eJmxModel.liveBeanEnabled;
LiveVariable<Boolean> lifeCycle = eJmxModel.lifeCycleEnabled;
LiveVariable<String> port = eJmxModel.port;
LiveVariable<String> timeout = eJmxModel.terminationTimeout;
LiveExpression<ValidationResult> validator = eJmxModel.getValidator();
liveBean.setValue(true);
lifeCycle.setValue(true);
timeout.setValue("5000");
port.setValue("8888");
assertOk(validator);
port.setValue("Unparseable");
assertError("can't be parsed as an Integer", validator);
jmx.setValue(false);
liveBean.setValue(false);
lifeCycle.setValue(false);
assertOk(validator); //if disabled we shouldn't check the port as it doesn't matter.
jmx.setValue(true);
port.setValue("10000000");
liveBean.setValue(true);
assertError("should be smaller than", validator);
jmx.setValue(false);
liveBean.setValue(false);
port.setValue("-111");
assertOk(validator); //if disabled we shouldn't check the port as it doesn't matter.
jmx.setValue(true);
lifeCycle.setValue(true); //only enable lifeCycle
assertFalse(liveBean.getValue());
assertError("should be a positive", validator);
port.setValue("0");
assertOk(validator); // 0 is acceptable as it means 'choose dynamically'.
port.setValue(" 8888 ");
assertOk(validator); // tolerate spaces
port.setValue(null); //
assertError("JMX Port must be specified", validator);
port.setValue(" "); //
assertError("JMX Port must be specified", validator);
port.setValue("");
assertError("JMX Port must be specified", validator);
port.setValue("8888");
assertOk(validator);
timeout.setValue(null);
assertError("Termination timeout must be specified", validator);
timeout.setValue("");
assertError("Termination timeout must be specified", validator);
timeout.setValue(" ");
assertError("Termination timeout must be specified", validator);
timeout.setValue(" 8888 "); // tolerate spaces
assertOk(validator);
timeout.setValue(" -555");
assertError("Termination timeout must be positive", validator);
timeout.setValue("abc");
assertError("Termination timeout can't be parsed as an Integer", validator);
}
public void testJmxSetDefaults() throws Exception {
EnableJmxFeaturesModel eJmxModel = this.model.enableJmx;
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
eJmxModel.setDefaults(wc);
assertEquals(BootLaunchActivator.getInstance().isLiveBeanSupported(), BootLaunchConfigurationDelegate.getEnableLiveBeanSupport(wc));
assertTrue(BootLaunchConfigurationDelegate.getEnableLifeCycle(wc));
int jmxPort = Integer.parseInt(BootLaunchConfigurationDelegate.getJMXPort(wc));
assertEquals(BootLaunchConfigurationDelegate.DEFAULT_JMX_PORT, jmxPort);
}
public void testJmxInitializeFrom() throws Exception {
EnableJmxFeaturesModel eJmxModel = this.model.enableJmx;
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
LiveVariable<Boolean> liveBean = eJmxModel.liveBeanEnabled;
LiveVariable<Boolean> lifeCycle = eJmxModel.lifeCycleEnabled;
LiveVariable<String> port = eJmxModel.port;
LiveVariable<Boolean> dirty = eJmxModel.getDirtyState();
boolean[] bools = {true, false};
for (boolean b1 : bools) {
for (boolean b2 : bools) {
BootLaunchConfigurationDelegate.setEnableLiveBeanSupport(wc, b1);
BootLaunchConfigurationDelegate.setEnableLifeCycle(wc, b2);
BootLaunchConfigurationDelegate.setJMXPort(wc, "3456");
dirty.setValue(true);
eJmxModel.initializeFrom(wc);
assertFalse(dirty.getValue());
assertEquals("3456", port.getValue());
assertEquals(b1, (boolean)liveBean.getValue());
assertEquals(b2, (boolean)lifeCycle.getValue());
}
}
}
public void testJmxPerformApply() throws Exception {
EnableJmxFeaturesModel eJmxModel = this.model.enableJmx;
ILaunchConfigurationWorkingCopy wc = createWorkingCopy();
LiveVariable<Boolean> liveBean = eJmxModel.liveBeanEnabled;
LiveVariable<Boolean> lifeCycle = eJmxModel.lifeCycleEnabled;
LiveVariable<String> port = eJmxModel.port;
LiveVariable<Boolean> dirty = eJmxModel.getDirtyState();
port.setValue("1234");
boolean[] bools = {true, false};
for (boolean b1 : bools) {
for (boolean b2 : bools) {
liveBean.setValue(b1);
lifeCycle.setValue(b2);
assertTrue(dirty.getValue());
eJmxModel.performApply(wc);
assertFalse(dirty.getValue());
assertEquals("1234", BootLaunchConfigurationDelegate.getJMXPort(wc));
assertEquals(b1, BootLaunchConfigurationDelegate.getEnableLiveBeanSupport(wc));
assertEquals(b2, BootLaunchConfigurationDelegate.getEnableLifeCycle(wc));
}
}
//port
port.setValue(" 8888 ");
assertTrue(dirty.getValue());
eJmxModel.performApply(wc);
assertFalse(dirty.getValue());
assertEquals("8888", BootLaunchConfigurationDelegate.getJMXPort(wc));
}
public void testLiveBeanDirtyState() throws Exception {
EnableJmxFeaturesModel eJmxModel = this.model.enableJmx;
LiveVariable<Boolean> liveBean = eJmxModel.liveBeanEnabled;
LiveVariable<Boolean> lifeCycle = eJmxModel.lifeCycleEnabled;
LiveVariable<String> port = eJmxModel.port;
LiveVariable<Boolean> dirty = eJmxModel.getDirtyState();
dirty.setValue(false);
port.setValue("something");
assertTrue(dirty.getValue());
dirty.setValue(false);
liveBean.setValue(!liveBean.getValue());
assertTrue(dirty.getValue());
dirty.setValue(false);
lifeCycle.setValue(!lifeCycle.getValue());
assertTrue(dirty.getValue());
}
///// PropertiesTableSection ??? can't be tested in its current form (no separate 'model' to test)
/**
* Verify contents of 'pulldown' menu. This ignores the order of the elements
* because discovered elements may come in different orders... but does not
* ignore when there are duplicates.
*/
private void assertPulldown(ProfileLaunchTabModel profile, String... expecteds) {
Arrays.sort(expecteds);
String [] actuals = profile.profileOptions().getValue();
actuals = Arrays.copyOf(actuals, actuals.length);
Arrays.sort(actuals);
assertArrayEquals(expecteds, actuals);
}
}

View File

@@ -0,0 +1,126 @@
/*******************************************************************************
* Copyright (c) 2015 Pivotal, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Pivotal, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.eclipse.boot.launch.test;
import org.eclipse.core.resources.IProject;
import org.springframework.ide.eclipse.boot.launch.profiles.ProfileHistory;
/**
* @author Kris De Volder
*/
public class ProfileHistoryTest extends BootLaunchTestCase {
private ProfileHistory history;
protected void setUp() throws Exception {
super.setUp();
history = new ProfileHistory();
}
public void testSimpleHistory() throws Exception {
IProject project = createGeneralProject("foo");
assertHistory(project /*empty*/);
history.updateHistory(project, "production");
assertHistory(project,
"production"
);
history.updateHistory(project, "development");
assertHistory(project,
"development",
"production"
);
history.updateHistory(project, "experimental");
assertHistory(project,
"experimental",
"development",
"production"
);
}
public void testMultiAddSame() throws Exception {
IProject project = createGeneralProject("foo");
assertHistory(project /*empty*/);
for (int i = 0; i < 10; i++) {
history.updateHistory(project, "foo");
assertHistory(project, "foo");
}
}
public void testExistingMovesToTop() throws Exception {
IProject project = createGeneralProject("foo");
assertHistory(project /*empty*/);
history.updateHistory(project, "production");
history.updateHistory(project, "development");
history.updateHistory(project, "experimental");
assertHistory(project,
"experimental",
"development",
"production"
);
history.updateHistory(project, "production");
assertHistory(project,
"production",
"experimental",
"development"
);
history.updateHistory(project, "production");
assertHistory(project,
"production",
"experimental",
"development"
);
history.updateHistory(project, "experimental");
assertHistory(project,
"experimental",
"production",
"development"
);
}
public void testOverflow() throws Exception {
IProject project = createGeneralProject("foo");
int maxHist = 4;
history.setMaxHistory(maxHist);
for (int i = 1; i <= 10; i++) {
history.updateHistory(project, "prof-"+i);
if (i>maxHist) {
String[] expected = new String[maxHist];
for (int j = 0; j < expected.length; j++) {
expected[j] = "prof-"+(i-j);
}
assertHistory(project, expected);
}
}
}
private void assertHistory(IProject project, String... expecteds) {
String[] actuals = history.getHistory(project);
StringBuilder actualStr = new StringBuilder();
StringBuilder expectStr = new StringBuilder();
for (String string : actuals) {
actualStr.append(string+"\n");
}
for (String string : expecteds) {
expectStr.append(string+"\n");
}
assertEquals(expectStr.toString(), actualStr.toString());
}
}

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>dump-info</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.core.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

View File

@@ -0,0 +1,4 @@
activeProfiles=pom.xml
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>dump-info</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>dump-info</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.DumpInfoApplication</start-class>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,63 @@
/*******************************************************************************
* Copyright (c) 2015 GoPivotal, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* GoPivotal, Inc. - initial API and implementation
*******************************************************************************/
package demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;
/**
* Simple Spring Boot application used by STS regression tests. The application
* prints out some info onto System.out and exits.
* <p>
* The test harness uses the output to verify whether launch parameters passed via
* STS BootLaunchconfiguration produce the expected result.
*
* @author Kris De Volder
*/
@SpringBootApplication
public class DumpInfoApplication implements CommandLineRunner {
public static String[] INTERESTING_PROPERTIES = {
"debug",
"zor",
"foo",
"bar",
"com.sun.management.jmxremote.port"
};
public static void main(String[] args) {
SpringApplication.run(DumpInfoApplication.class, args);
}
@Autowired
Environment properties;
@Override
public void run(String... args) throws Exception {
System.out.println(">>>properties");
for (String prop : INTERESTING_PROPERTIES) {
System.out.println(prop+"="+render(properties.getProperty(prop)));
}
System.out.println("<<<properties");
}
private String render(String propertyValue) {
if (propertyValue==null) {
return "null";
} else {
return "'"+propertyValue+"'";
}
}
}

View File

@@ -0,0 +1,16 @@
package demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = DumpInfoApplication.class)
public class DumpInfoApplicationTests {
@Test
public void contextLoads() {
}
}

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>empty-boot-project</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.core.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

View File

@@ -0,0 +1,4 @@
activeProfiles=pom.xml
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>empty-boot-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>empty-boot-project</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.EmptyBootProjectApplication</start-class>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,12 @@
package demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class AlternateMain {
public static void main(String[] args) {
SpringApplication.run(AlternateMain.class, args);
}
}

View File

@@ -0,0 +1,12 @@
package demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class EmptyBootProjectApplication {
public static void main(String[] args) {
SpringApplication.run(EmptyBootProjectApplication.class, args);
}
}

View File

@@ -0,0 +1,16 @@
package demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = EmptyBootProjectApplication.class)
public class EmptyBootProjectApplicationTests {
@Test
public void contextLoads() {
}
}

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>project with spaces</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.core.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

View File

@@ -0,0 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

View File

@@ -0,0 +1,4 @@
activeProfiles=pom.xml
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>dump-info</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>project with spaces</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.DumpInfoApplication</start-class>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,63 @@
/*******************************************************************************
* Copyright (c) 2015 GoPivotal, 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
* https://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* GoPivotal, Inc. - initial API and implementation
*******************************************************************************/
package demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.core.env.Environment;
/**
* Simple Spring Boot application used by STS regression tests. The application
* prints out some info onto System.out and exits.
* <p>
* The test harness uses the output to verify whether launch parameters passed via
* STS BootLaunchconfiguration produce the expected result.
*
* @author Kris De Volder
*/
@SpringBootApplication
public class DumpInfoApplication implements CommandLineRunner {
public static String[] INTERESTING_PROPERTIES = {
"debug",
"zor",
"foo",
"bar",
"com.sun.management.jmxremote.port"
};
public static void main(String[] args) {
SpringApplication.run(DumpInfoApplication.class, args);
}
@Autowired
Environment properties;
@Override
public void run(String... args) throws Exception {
System.out.println(">>>properties");
for (String prop : INTERESTING_PROPERTIES) {
System.out.println(prop+"="+render(properties.getProperty(prop)));
}
System.out.println("<<<properties");
}
private String render(String propertyValue) {
if (propertyValue==null) {
return "null";
} else {
return "'"+propertyValue+"'";
}
}
}

View File

@@ -0,0 +1,16 @@
package demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = DumpInfoApplication.class)
public class DumpInfoApplicationTests {
@Test
public void contextLoads() {
}
}