diff --git a/eclipse-distribution/org.springframework.boot.ide.branding.feature/build.properties b/eclipse-distribution/org.springframework.boot.ide.branding.feature/build.properties index 64f93a9f0..3c54be93f 100644 --- a/eclipse-distribution/org.springframework.boot.ide.branding.feature/build.properties +++ b/eclipse-distribution/org.springframework.boot.ide.branding.feature/build.properties @@ -1 +1,2 @@ -bin.includes = feature.xml +bin.includes = feature.xml,\ + p2.inf diff --git a/eclipse-distribution/org.springframework.boot.ide.branding.feature/p2.inf b/eclipse-distribution/org.springframework.boot.ide.branding.feature/p2.inf new file mode 100644 index 000000000..db72e641d --- /dev/null +++ b/eclipse-distribution/org.springframework.boot.ide.branding.feature/p2.inf @@ -0,0 +1,7 @@ +# tell pde.build not to generate start levels +org.eclipse.pde.build.append.startlevels=false + +# add requirement on org.eclipse.platform.ide +requires.1.namespace=org.eclipse.equinox.p2.iu +requires.1.name=org.eclipse.platform.ide +requires.1.greedy=true diff --git a/eclipse-distribution/org.springframework.boot.ide.branding/META-INF/MANIFEST.MF b/eclipse-distribution/org.springframework.boot.ide.branding/META-INF/MANIFEST.MF index eedb0870b..ab3c43ee1 100644 --- a/eclipse-distribution/org.springframework.boot.ide.branding/META-INF/MANIFEST.MF +++ b/eclipse-distribution/org.springframework.boot.ide.branding/META-INF/MANIFEST.MF @@ -14,3 +14,4 @@ Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.core.runtime, org.eclipse.osgi.service.datalocation, org.osgi.framework +Eclipse-BundleShape: dir diff --git a/eclipse-distribution/org.springframework.boot.ide.product.e410/org.springframework.boot.ide.product b/eclipse-distribution/org.springframework.boot.ide.product.e410/org.springframework.boot.ide.product index a0752deb8..67ceefda0 100644 --- a/eclipse-distribution/org.springframework.boot.ide.product.e410/org.springframework.boot.ide.product +++ b/eclipse-distribution/org.springframework.boot.ide.product.e410/org.springframework.boot.ide.product @@ -7,25 +7,28 @@ -product org.springframework.boot.ide.branding.sts4 ---launcher.defaultAction -openFile +--launcher.defaultAction openFile + -Dosgi.requiredJavaVersion=1.8 +-Xms256m +-Xmx1024m +-XX:+UseG1GC +-XX:+UseStringDeduplication --add-modules=ALL-SYSTEM --Xms40m - -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -Xdock:icon=../Resources/sts4.icns - -Xmx1200m + + + + -XstartOnFirstThread +-Dorg.eclipse.swt.internal.carbon.smallFonts -Xdock:icon=../Resources/sts4.icns - -Xmx1200m - - -Xmx1200m - @@ -40,8 +43,8 @@ openFile - - + + @@ -95,20 +98,13 @@ openFile - + - - - - - - - - + diff --git a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/ContextPath.java b/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/ContextPath.java index a387df8f2..712b43057 100644 --- a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/ContextPath.java +++ b/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/ContextPath.java @@ -11,7 +11,6 @@ package org.springframework.ide.vscode.commons.boot.app.cli; import java.util.Collection; -import java.util.Set; import org.json.JSONArray; import org.json.JSONObject; @@ -26,57 +25,37 @@ public class ContextPath { protected static Logger logger = LoggerFactory.getLogger(ContextPath.class); public static final Collection BOOT_1X_CONTEXTPATH = ImmutableList.of("server.context-path", - "server.contextPath"); + "server.contextPath", "SERVER_CONTEXT_PATH"); public static final Collection BOOT_2X_CONTEXTPATH = ImmutableList.of("server.servlet.context-path", - "server.servlet.contextPath"); + "server.servlet.contextPath", "SERVER_SERVLET_CONTEXT_PATH"); public static String getContextPath(String bootVersion, String environment) { - + String contextPath = null; if (environment != null) { JSONObject env = new JSONObject(environment); - Collection contextPathProperties = null; if ("1.x".equals(bootVersion)) { - contextPathProperties = BOOT_1X_CONTEXTPATH; + contextPath = findContextPathInBoot1x(env); } else if ("2.x".equals(bootVersion)) { - contextPathProperties = BOOT_2X_CONTEXTPATH; - } - - if (contextPathProperties != null) { - for (String prop : contextPathProperties) { - String contextPath = findContextPath(env, prop); - if (StringUtil.hasText(contextPath)) { - return contextPath; - } - } + contextPath = findContextPathInBoot2x(env); } } - return null; - } - - private static String findContextPath(JSONObject env, String contextPathProp) { - String contextPath = null; - if (env != null) { - // Properties defined in command line args have higher priority over - // those defined in application configuration files (properties/yaml files) - contextPath = findInCommandLineArgs(env, contextPathProp); - if (contextPath == null) { - contextPath = findInApplicationConfig(env, contextPathProp); - } - } return contextPath; } - private static String findInApplicationConfig(JSONObject env, String contextPathProp) { - // boot 1.x - JSONObject applicationConfig = null; + private static String findContextPathInBoot1x(JSONObject env) { + // IMPORTANT: The order in which the env objects appear are assumed to be the + // priority order defined + // by boot rules in terms of which property source has higher precedence. Iterate + // through ALL + // sources in the order obtained from the env JSON for (String key : env.keySet()) { - if (key.startsWith("applicationConfig")) { - applicationConfig = env.getJSONObject(key); - if (applicationConfig != null) { - String contextPathValue = applicationConfig.optString(contextPathProp); + JSONObject jsonObj = env.optJSONObject(key); + if (jsonObj != null) { + for (String prop : BOOT_1X_CONTEXTPATH) { + String contextPathValue = jsonObj.optString(prop); // Warning: fetching value above may return empty string, so null check on the // value is not enough if (StringUtil.hasText(contextPathValue)) { @@ -85,70 +64,27 @@ public class ContextPath { } } } - - // boot 2.x - if (applicationConfig == null) { - // Not found as direct property value... in Boot 2.0 we must look inside the - // 'propertySources'. - // Similar... but structure is more complex. - JSONArray propertySources = env.optJSONArray("propertySources"); - if (propertySources != null) { - for (Object _source : propertySources) { - if (_source instanceof JSONObject) { - JSONObject source = (JSONObject) _source; - String sourceName = source.optString("name"); - if (sourceName != null && sourceName.startsWith("applicationConfig")) { - JSONObject props = source.optJSONObject("properties"); - Set keySet = props.keySet(); - // Check that the context is a key before retrieving the JSON object value. - // Note: attempting to fetch the JSON object value on a key that may not exist - // throws exception - // thus the reason why we are checking that the key exists first - if (keySet.contains(contextPathProp)) { - JSONObject jsonObject = props.getJSONObject(contextPathProp); - if (jsonObject != null) { - String contextPathValue = jsonObject.optString("value"); - if (StringUtil.hasText(contextPathValue)) { - return contextPathValue; - } - } - } - } - } - } - } - } return null; } - protected static String findInCommandLineArgs(JSONObject env, String contextPathProp) { - // boot 1.x - JSONObject commandLineArgs = env.optJSONObject("commandLineArgs"); - if (commandLineArgs != null) { - String contextPathValue = commandLineArgs.optString(contextPathProp); - // Warning: fetching value above may return empty string, so null check on the - // value is not enough - if (StringUtil.hasText(contextPathValue)) { - return contextPathValue; - } - } - // boot 2.x - if (commandLineArgs == null) { - // Not found as direct property value... in Boot 2.0 we must look inside the - // 'propertySources'. - // Similar... but structure is more complex. - JSONArray propertySources = env.optJSONArray("propertySources"); - if (propertySources != null) { - for (Object _source : propertySources) { - if (_source instanceof JSONObject) { - JSONObject source = (JSONObject) _source; - String sourceName = source.optString("name"); - if ("commandLineArgs".equals(sourceName)) { - JSONObject props = source.optJSONObject("properties"); - // Find the contextPathProp in the command line args - JSONObject valueObject = props.optJSONObject(contextPathProp); - if (valueObject != null) { - String contextPathValue = valueObject.optString("value"); + private static String findContextPathInBoot2x(JSONObject env) { + JSONArray propertySources = env.optJSONArray("propertySources"); + if (propertySources != null) { + + // IMPORTANT: The order in which the env objects appear are assumed to be the + // priority order defined + // by boot rules in terms of which property source has higher precedence. Iterate + // through ALL + // sources in the order obtained from the env JSON + for (Object _source : propertySources) { + if (_source instanceof JSONObject) { + JSONObject source = (JSONObject) _source; + JSONObject props = source.optJSONObject("properties"); + if (props != null) { + for (String property : BOOT_2X_CONTEXTPATH) { + JSONObject propertyObj = props.optJSONObject(property); + if (propertyObj != null) { + String contextPathValue = propertyObj.optString("value"); if (StringUtil.hasText(contextPathValue)) { return contextPathValue; } diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/AcuatorEnvTestConstants.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/AcuatorEnvTestConstants.java new file mode 100644 index 000000000..fab6e1f43 --- /dev/null +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/AcuatorEnvTestConstants.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2018 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Pivotal, Inc. - initial API and implementation + *******************************************************************************/ +package org.springframework.ide.vscode.boot.java.requestmapping.test; + +public class AcuatorEnvTestConstants { + + // Kebab Case: `server.servlet.context-path` + // REAL `/env` from actuator data from a Boot 2.x JSON from an actual running app that contains 3 different definitions for server context path. + public static final String BOOT_2x_ENV_CONTEXT_PATH_KEBAB_CASE = "{\"activeProfiles\":[],\"propertySources\":[{\"name\":\"server.ports\",\"properties\":{\"local.server.port\":{\"value\":8080}}}," + // context-path defined in command line args + + "{\"name\":\"commandLineArgs\",\"properties\":{\"spring.output.ansi.enabled\":{\"value\":\"always\"},\"server.servlet.context-path\":{\"value\":\"/pathfromcommandlineargs\"}}}" + // Ignore this line. Extra information not needed for context path tests + + ",{\"name\":\"servletContextInitParams\",\"properties\":{}},{\"name\":\"systemProperties\",\"properties\":{\"com.sun.management.jmxremote.authenticate\":{\"value\":\"false\"},\"java.runtime.name\":{\"value\":\"Java(TM) SE Runtime Environment\"},\"sun.boot.library.path\":{\"value\":\"/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib\"},\"java.vm.version\":{\"value\":\"25.144-b01\"},\"gopherProxySet\":{\"value\":\"false\"},\"java.vm.vendor\":{\"value\":\"Oracle Corporation\"},\"java.vendor.url\":{\"value\":\"http://java.oracle.com/\"},\"java.rmi.server.randomIDs\":{\"value\":\"true\"},\"path.separator\":{\"value\":\":\"},\"java.vm.name\":{\"value\":\"Java HotSpot(TM) 64-Bit Server VM\"},\"file.encoding.pkg\":{\"value\":\"sun.io\"},\"user.country\":{\"value\":\"CA\"},\"sun.java.launcher\":{\"value\":\"SUN_STANDARD\"},\"sun.os.patch.level\":{\"value\":\"unknown\"},\"PID\":{\"value\":\"46108\"},\"com.sun.management.jmxremote.port\":{\"value\":\"62402\"},\"java.vm.specification.name\":{\"value\":\"Java Virtual Machine Specification\"},\"user.dir\":{\"value\":\"/Users/nierajsingh/sts4dev/rt-boot-java-ls/demoWithConditionalsboot20\"},\"java.runtime.version\":{\"value\":\"1.8.0_144-b01\"},\"java.awt.graphicsenv\":{\"value\":\"sun.awt.CGraphicsEnvironment\"},\"java.endorsed.dirs\":{\"value\":\"/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/endorsed\"},\"os.arch\":{\"value\":\"x86_64\"},\"java.io.tmpdir\":{\"value\":\"/var/folders/hj/ykvzmmmj4wl5tk959bdfss5w0000gp/T/\"},\"line.separator\":{\"value\":\"\\n\"},\"java.vm.specification.vendor\":{\"value\":\"Oracle Corporation\"},\"os.name\":{\"value\":\"Mac OS X\"},\"sun.jnu.encoding\":{\"value\":\"UTF-8\"},\"spring.beaninfo.ignore\":{\"value\":\"true\"},\"java.library.path\":{\"value\":\"/Users/nierajsingh/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.\"},\"java.specification.name\":{\"value\":\"Java Platform API Specification\"},\"java.class.version\":{\"value\":\"52.0\"},\"sun.management.compiler\":{\"value\":\"HotSpot 64-Bit Tiered Compilers\"},\"os.version\":{\"value\":\"10.13.6\"},\"http.nonProxyHosts\":{\"value\":\"local|*.local|169.254/16|*.169.254/16\"},\"user.home\":{\"value\":\"/Users/nierajsingh\"},\"catalina.useNaming\":{\"value\":\"false\"},\"user.timezone\":{\"value\":\"America/Vancouver\"},\"java.awt.printerjob\":{\"value\":\"sun.lwawt.macosx.CPrinterJob\"},\"file.encoding\":{\"value\":\"UTF-8\"},\"java.specification.version\":{\"value\":\"1.8\"},\"catalina.home\":{\"value\":\"/private/var/folders/hj/ykvzmmmj4wl5tk959bdfss5w0000gp/T/tomcat.703612320943979832.8080\"},\"java.class.path\":{\"value\":\"/Users/nierajsingh/sts4dev/rt-boot-java-ls/demoWithConditionalsboot20/target/classes:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.1.0.RELEASE/spring-boot-starter-web-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter/2.1.0.RELEASE/spring-boot-starter-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot/2.1.0.RELEASE/spring-boot-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.1.0.RELEASE/spring-boot-autoconfigure-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.1.0.RELEASE/spring-boot-starter-logging-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/nierajsingh/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/nierajsingh/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.11.1/log4j-to-slf4j-2.11.1.jar:/Users/nierajsingh/.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar:/Users/nierajsingh/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar:/Users/nierajsingh/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar:/Users/nierajsingh/.m2/repository/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.1.0.RELEASE/spring-boot-starter-json-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.7/jackson-databind-2.9.7.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.7/jackson-core-2.9.7.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.7/jackson-datatype-jdk8-2.9.7.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.7/jackson-datatype-jsr310-2.9.7.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.7/jackson-module-parameter-names-2.9.7.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.1.0.RELEASE/spring-boot-starter-tomcat-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.12/tomcat-embed-core-9.0.12.jar:/Users/nierajsingh/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.12/tomcat-embed-el-9.0.12.jar:/Users/nierajsingh/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.12/tomcat-embed-websocket-9.0.12.jar:/Users/nierajsingh/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.13.Final/hibernate-validator-6.0.13.Final.jar:/Users/nierajsingh/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/Users/nierajsingh/.m2/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/classmate/1.4.0/classmate-1.4.0.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-web/5.1.2.RELEASE/spring-web-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-beans/5.1.2.RELEASE/spring-beans-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-webmvc/5.1.2.RELEASE/spring-webmvc-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-aop/5.1.2.RELEASE/spring-aop-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-context/5.1.2.RELEASE/spring-context-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-expression/5.1.2.RELEASE/spring-expression-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter-web-services/2.1.0.RELEASE/spring-boot-starter-web-services-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/com/sun/xml/messaging/saaj/saaj-impl/1.5.0/saaj-impl-1.5.0.jar:/Users/nierajsingh/.m2/repository/javax/xml/soap/javax.xml.soap-api/1.4.0/javax.xml.soap-api-1.4.0.jar:/Users/nierajsingh/.m2/repository/org/jvnet/mimepull/mimepull/1.9.10/mimepull-1.9.10.jar:/Users/nierajsingh/.m2/repository/org/jvnet/staxex/stax-ex/1.8/stax-ex-1.8.jar:/Users/nierajsingh/.m2/repository/javax/xml/ws/jaxws-api/2.3.1/jaxws-api-2.3.1.jar:/Users/nierajsingh/.m2/repository/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar:/Users/nierajsingh/.m2/repository/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-oxm/5.1.2.RELEASE/spring-oxm-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/ws/spring-ws-core/3.0.4.RELEASE/spring-ws-core-3.0.4.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/ws/spring-xml/3.0.4.RELEASE/spring-xml-3.0.4.RELEASE.jar:/Users/nierajsingh/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar:/Users/nierajsingh/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-core/5.1.2.RELEASE/spring-core-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-jcl/5.1.2.RELEASE/spring-jcl-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/2.1.0.RELEASE/spring-boot-starter-actuator-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.1.0.RELEASE/spring-boot-actuator-autoconfigure-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-actuator/2.1.0.RELEASE/spring-boot-actuator-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/io/micrometer/micrometer-core/1.1.0/micrometer-core-1.1.0.jar:/Users/nierajsingh/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar:/Users/nierajsingh/.m2/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar\"},\"user.name\":{\"value\":\"nierajsingh\"},\"com.sun.management.jmxremote\":{\"value\":\"\"},\"java.vm.specification.version\":{\"value\":\"1.8\"},\"sun.java.command\":{\"value\":\"******\"},\"java.home\":{\"value\":\"/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre\"},\"sun.arch.data.model\":{\"value\":\"64\"},\"user.language\":{\"value\":\"en\"},\"java.specification.vendor\":{\"value\":\"Oracle Corporation\"},\"awt.toolkit\":{\"value\":\"sun.lwawt.macosx.LWCToolkit\"},\"com.sun.management.jmxremote.ssl\":{\"value\":\"false\"},\"java.vm.info\":{\"value\":\"mixed mode\"},\"java.version\":{\"value\":\"1.8.0_144\"},\"java.ext.dirs\":{\"value\":\"/Users/nierajsingh/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java\"},\"sun.boot.class.path\":{\"value\":\"/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/classes\"},\"java.awt.headless\":{\"value\":\"true\"},\"java.vendor\":{\"value\":\"Oracle Corporation\"},\"catalina.base\":{\"value\":\"/private/var/folders/hj/ykvzmmmj4wl5tk959bdfss5w0000gp/T/tomcat.703612320943979832.8080\"},\"spring.application.admin.enabled\":{\"value\":\"true\"},\"java.security.egd\":{\"value\":\"file:/dev/./urandom\"},\"file.separator\":{\"value\":\"/\"},\"java.vendor.url.bug\":{\"value\":\"http://bugreport.sun.com/bugreport/\"},\"sun.io.unicode.encoding\":{\"value\":\"UnicodeBig\"},\"sun.cpu.endian\":{\"value\":\"little\"},\"java.rmi.server.hostname\":{\"value\":\"localhost\"},\"socksNonProxyHosts\":{\"value\":\"local|*.local|169.254/16|*.169.254/16\"},\"ftp.nonProxyHosts\":{\"value\":\"local|*.local|169.254/16|*.169.254/16\"},\"sun.cpu.isalist\":{\"value\":\"\"}}}," + // context path defined in ENV VAR + + "{\"name\":\"systemEnvironment\",\"properties\":{\"SERVER_SERVLET_CONTEXT_PATH\":{\"value\":\"/pathfromenvironment\",\"origin\":\"System Environment Property \\\"SERVER_SERVLET_CONTEXT_PATH\\\"\"},\"JAVA_STARTED_ON_FIRST_THREAD_46095\":{\"value\":\"1\",\"origin\":\"System Environment Property \\\"JAVA_STARTED_ON_FIRST_THREAD_46095\\\"\"},\"PATH\":{\"value\":\"/usr/bin:/bin:/usr/sbin:/sbin\",\"origin\":\"System Environment Property \\\"PATH\\\"\"},\"SHELL\":{\"value\":\"/bin/bash\",\"origin\":\"System Environment Property \\\"SHELL\\\"\"},\"JAVA_STARTED_ON_FIRST_THREAD_45890\":{\"value\":\"1\",\"origin\":\"System Environment Property \\\"JAVA_STARTED_ON_FIRST_THREAD_45890\\\"\"},\"JAVA_MAIN_CLASS_46108\":{\"value\":\"com.example.demo.DemoApplication\",\"origin\":\"System Environment Property \\\"JAVA_MAIN_CLASS_46108\\\"\"},\"USER\":{\"value\":\"nierajsingh\",\"origin\":\"System Environment Property \\\"USER\\\"\"},\"TMPDIR\":{\"value\":\"/var/folders/hj/ykvzmmmj4wl5tk959bdfss5w0000gp/T/\",\"origin\":\"System Environment Property \\\"TMPDIR\\\"\"},\"SSH_AUTH_SOCK\":{\"value\":\"/private/tmp/com.apple.launchd.Edc0D0QqVQ/Listeners\",\"origin\":\"System Environment Property \\\"SSH_AUTH_SOCK\\\"\"},\"DISPLAY\":{\"value\":\"/private/tmp/com.apple.launchd.8djHo5qh6H/org.macosforge.xquartz:0\",\"origin\":\"System Environment Property \\\"DISPLAY\\\"\"},\"XPC_FLAGS\":{\"value\":\"0x0\",\"origin\":\"System Environment Property \\\"XPC_FLAGS\\\"\"},\"APP_ICON_45890\":{\"value\":\"../Resources/sts4.icns\",\"origin\":\"System Environment Property \\\"APP_ICON_45890\\\"\"},\"JAVA_MAIN_CLASS_46095\":{\"value\":\"org.eclipse.equinox.launcher.Main\",\"origin\":\"System Environment Property \\\"JAVA_MAIN_CLASS_46095\\\"\"},\"__CF_USER_TEXT_ENCODING\":{\"value\":\"0x1F6:0x0:0x52\",\"origin\":\"System Environment Property \\\"__CF_USER_TEXT_ENCODING\\\"\"},\"Apple_PubSub_Socket_Render\":{\"value\":\"/private/tmp/com.apple.launchd.wiuBp605jW/Render\",\"origin\":\"System Environment Property \\\"Apple_PubSub_Socket_Render\\\"\"},\"LOGNAME\":{\"value\":\"nierajsingh\",\"origin\":\"System Environment Property \\\"LOGNAME\\\"\"},\"XPC_SERVICE_NAME\":{\"value\":\"org.springframework.boot.ide.branding.sts4.24084\",\"origin\":\"System Environment Property \\\"XPC_SERVICE_NAME\\\"\"},\"HOME\":{\"value\":\"/Users/nierajsingh\",\"origin\":\"System Environment Property \\\"HOME\\\"\"}}}," + // context path defined in applicationConfi + + "{\"name\":\"applicationConfig: [file:./application.properties]\",\"properties\":{\"server.servlet.context-path\":{\"value\":\"/pathfromapplicationconfig\",\"origin\":\"URL [file:./application.properties]:1:28\"}}}]}\n"; + + + // Camel Case: `server.servlet.contextPath` + // REAL `/env` from actuator data from a Boot 2.x JSON from an actual running app that contains 3 different definitions for server context path. + public static final String BOOT_2x_ENV_CONTEXT_PATH_CAMEL_CASE = "{\"activeProfiles\":[],\"propertySources\":[{\"name\":\"server.ports\",\"properties\":{\"local.server.port\":{\"value\":8080}}}," + // context-path defined in command line args + + "{\"name\":\"commandLineArgs\",\"properties\":{\"spring.output.ansi.enabled\":{\"value\":\"always\"},\"server.servlet.contextPath\":{\"value\":\"/pathfromcommandlineargs\"}}}" + // Ignore this line. Extra information not needed for context path tests + + ",{\"name\":\"servletContextInitParams\",\"properties\":{}},{\"name\":\"systemProperties\",\"properties\":{\"com.sun.management.jmxremote.authenticate\":{\"value\":\"false\"},\"java.runtime.name\":{\"value\":\"Java(TM) SE Runtime Environment\"},\"sun.boot.library.path\":{\"value\":\"/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib\"},\"java.vm.version\":{\"value\":\"25.144-b01\"},\"gopherProxySet\":{\"value\":\"false\"},\"java.vm.vendor\":{\"value\":\"Oracle Corporation\"},\"java.vendor.url\":{\"value\":\"http://java.oracle.com/\"},\"java.rmi.server.randomIDs\":{\"value\":\"true\"},\"path.separator\":{\"value\":\":\"},\"java.vm.name\":{\"value\":\"Java HotSpot(TM) 64-Bit Server VM\"},\"file.encoding.pkg\":{\"value\":\"sun.io\"},\"user.country\":{\"value\":\"CA\"},\"sun.java.launcher\":{\"value\":\"SUN_STANDARD\"},\"sun.os.patch.level\":{\"value\":\"unknown\"},\"PID\":{\"value\":\"46108\"},\"com.sun.management.jmxremote.port\":{\"value\":\"62402\"},\"java.vm.specification.name\":{\"value\":\"Java Virtual Machine Specification\"},\"user.dir\":{\"value\":\"/Users/nierajsingh/sts4dev/rt-boot-java-ls/demoWithConditionalsboot20\"},\"java.runtime.version\":{\"value\":\"1.8.0_144-b01\"},\"java.awt.graphicsenv\":{\"value\":\"sun.awt.CGraphicsEnvironment\"},\"java.endorsed.dirs\":{\"value\":\"/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/endorsed\"},\"os.arch\":{\"value\":\"x86_64\"},\"java.io.tmpdir\":{\"value\":\"/var/folders/hj/ykvzmmmj4wl5tk959bdfss5w0000gp/T/\"},\"line.separator\":{\"value\":\"\\n\"},\"java.vm.specification.vendor\":{\"value\":\"Oracle Corporation\"},\"os.name\":{\"value\":\"Mac OS X\"},\"sun.jnu.encoding\":{\"value\":\"UTF-8\"},\"spring.beaninfo.ignore\":{\"value\":\"true\"},\"java.library.path\":{\"value\":\"/Users/nierajsingh/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.\"},\"java.specification.name\":{\"value\":\"Java Platform API Specification\"},\"java.class.version\":{\"value\":\"52.0\"},\"sun.management.compiler\":{\"value\":\"HotSpot 64-Bit Tiered Compilers\"},\"os.version\":{\"value\":\"10.13.6\"},\"http.nonProxyHosts\":{\"value\":\"local|*.local|169.254/16|*.169.254/16\"},\"user.home\":{\"value\":\"/Users/nierajsingh\"},\"catalina.useNaming\":{\"value\":\"false\"},\"user.timezone\":{\"value\":\"America/Vancouver\"},\"java.awt.printerjob\":{\"value\":\"sun.lwawt.macosx.CPrinterJob\"},\"file.encoding\":{\"value\":\"UTF-8\"},\"java.specification.version\":{\"value\":\"1.8\"},\"catalina.home\":{\"value\":\"/private/var/folders/hj/ykvzmmmj4wl5tk959bdfss5w0000gp/T/tomcat.703612320943979832.8080\"},\"java.class.path\":{\"value\":\"/Users/nierajsingh/sts4dev/rt-boot-java-ls/demoWithConditionalsboot20/target/classes:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter-web/2.1.0.RELEASE/spring-boot-starter-web-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter/2.1.0.RELEASE/spring-boot-starter-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot/2.1.0.RELEASE/spring-boot-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/2.1.0.RELEASE/spring-boot-autoconfigure-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter-logging/2.1.0.RELEASE/spring-boot-starter-logging-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/Users/nierajsingh/.m2/repository/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/Users/nierajsingh/.m2/repository/org/apache/logging/log4j/log4j-to-slf4j/2.11.1/log4j-to-slf4j-2.11.1.jar:/Users/nierajsingh/.m2/repository/org/apache/logging/log4j/log4j-api/2.11.1/log4j-api-2.11.1.jar:/Users/nierajsingh/.m2/repository/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar:/Users/nierajsingh/.m2/repository/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar:/Users/nierajsingh/.m2/repository/org/yaml/snakeyaml/1.23/snakeyaml-1.23.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter-json/2.1.0.RELEASE/spring-boot-starter-json-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.9.7/jackson-databind-2.9.7.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.9.7/jackson-core-2.9.7.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.9.7/jackson-datatype-jdk8-2.9.7.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.7/jackson-datatype-jsr310-2.9.7.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.9.7/jackson-module-parameter-names-2.9.7.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/2.1.0.RELEASE/spring-boot-starter-tomcat-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/9.0.12/tomcat-embed-core-9.0.12.jar:/Users/nierajsingh/.m2/repository/org/apache/tomcat/embed/tomcat-embed-el/9.0.12/tomcat-embed-el-9.0.12.jar:/Users/nierajsingh/.m2/repository/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.12/tomcat-embed-websocket-9.0.12.jar:/Users/nierajsingh/.m2/repository/org/hibernate/validator/hibernate-validator/6.0.13.Final/hibernate-validator-6.0.13.Final.jar:/Users/nierajsingh/.m2/repository/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar:/Users/nierajsingh/.m2/repository/org/jboss/logging/jboss-logging/3.3.2.Final/jboss-logging-3.3.2.Final.jar:/Users/nierajsingh/.m2/repository/com/fasterxml/classmate/1.4.0/classmate-1.4.0.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-web/5.1.2.RELEASE/spring-web-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-beans/5.1.2.RELEASE/spring-beans-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-webmvc/5.1.2.RELEASE/spring-webmvc-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-aop/5.1.2.RELEASE/spring-aop-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-context/5.1.2.RELEASE/spring-context-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-expression/5.1.2.RELEASE/spring-expression-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter-web-services/2.1.0.RELEASE/spring-boot-starter-web-services-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/com/sun/xml/messaging/saaj/saaj-impl/1.5.0/saaj-impl-1.5.0.jar:/Users/nierajsingh/.m2/repository/javax/xml/soap/javax.xml.soap-api/1.4.0/javax.xml.soap-api-1.4.0.jar:/Users/nierajsingh/.m2/repository/org/jvnet/mimepull/mimepull/1.9.10/mimepull-1.9.10.jar:/Users/nierajsingh/.m2/repository/org/jvnet/staxex/stax-ex/1.8/stax-ex-1.8.jar:/Users/nierajsingh/.m2/repository/javax/xml/ws/jaxws-api/2.3.1/jaxws-api-2.3.1.jar:/Users/nierajsingh/.m2/repository/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar:/Users/nierajsingh/.m2/repository/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-oxm/5.1.2.RELEASE/spring-oxm-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/ws/spring-ws-core/3.0.4.RELEASE/spring-ws-core-3.0.4.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/ws/spring-xml/3.0.4.RELEASE/spring-xml-3.0.4.RELEASE.jar:/Users/nierajsingh/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar:/Users/nierajsingh/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-core/5.1.2.RELEASE/spring-core-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/spring-jcl/5.1.2.RELEASE/spring-jcl-5.1.2.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-starter-actuator/2.1.0.RELEASE/spring-boot-starter-actuator-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-actuator-autoconfigure/2.1.0.RELEASE/spring-boot-actuator-autoconfigure-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/org/springframework/boot/spring-boot-actuator/2.1.0.RELEASE/spring-boot-actuator-2.1.0.RELEASE.jar:/Users/nierajsingh/.m2/repository/io/micrometer/micrometer-core/1.1.0/micrometer-core-1.1.0.jar:/Users/nierajsingh/.m2/repository/org/hdrhistogram/HdrHistogram/2.1.9/HdrHistogram-2.1.9.jar:/Users/nierajsingh/.m2/repository/org/latencyutils/LatencyUtils/2.0.3/LatencyUtils-2.0.3.jar\"},\"user.name\":{\"value\":\"nierajsingh\"},\"com.sun.management.jmxremote\":{\"value\":\"\"},\"java.vm.specification.version\":{\"value\":\"1.8\"},\"sun.java.command\":{\"value\":\"******\"},\"java.home\":{\"value\":\"/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre\"},\"sun.arch.data.model\":{\"value\":\"64\"},\"user.language\":{\"value\":\"en\"},\"java.specification.vendor\":{\"value\":\"Oracle Corporation\"},\"awt.toolkit\":{\"value\":\"sun.lwawt.macosx.LWCToolkit\"},\"com.sun.management.jmxremote.ssl\":{\"value\":\"false\"},\"java.vm.info\":{\"value\":\"mixed mode\"},\"java.version\":{\"value\":\"1.8.0_144\"},\"java.ext.dirs\":{\"value\":\"/Users/nierajsingh/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java\"},\"sun.boot.class.path\":{\"value\":\"/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/classes\"},\"java.awt.headless\":{\"value\":\"true\"},\"java.vendor\":{\"value\":\"Oracle Corporation\"},\"catalina.base\":{\"value\":\"/private/var/folders/hj/ykvzmmmj4wl5tk959bdfss5w0000gp/T/tomcat.703612320943979832.8080\"},\"spring.application.admin.enabled\":{\"value\":\"true\"},\"java.security.egd\":{\"value\":\"file:/dev/./urandom\"},\"file.separator\":{\"value\":\"/\"},\"java.vendor.url.bug\":{\"value\":\"http://bugreport.sun.com/bugreport/\"},\"sun.io.unicode.encoding\":{\"value\":\"UnicodeBig\"},\"sun.cpu.endian\":{\"value\":\"little\"},\"java.rmi.server.hostname\":{\"value\":\"localhost\"},\"socksNonProxyHosts\":{\"value\":\"local|*.local|169.254/16|*.169.254/16\"},\"ftp.nonProxyHosts\":{\"value\":\"local|*.local|169.254/16|*.169.254/16\"},\"sun.cpu.isalist\":{\"value\":\"\"}}}," + // context path defined in ENV VAR + + "{\"name\":\"systemEnvironment\",\"properties\":{\"SERVER_SERVLET_CONTEXT_PATH\":{\"value\":\"/pathfromenvironment\",\"origin\":\"System Environment Property \\\"SERVER_SERVLET_CONTEXT_PATH\\\"\"},\"JAVA_STARTED_ON_FIRST_THREAD_46095\":{\"value\":\"1\",\"origin\":\"System Environment Property \\\"JAVA_STARTED_ON_FIRST_THREAD_46095\\\"\"},\"PATH\":{\"value\":\"/usr/bin:/bin:/usr/sbin:/sbin\",\"origin\":\"System Environment Property \\\"PATH\\\"\"},\"SHELL\":{\"value\":\"/bin/bash\",\"origin\":\"System Environment Property \\\"SHELL\\\"\"},\"JAVA_STARTED_ON_FIRST_THREAD_45890\":{\"value\":\"1\",\"origin\":\"System Environment Property \\\"JAVA_STARTED_ON_FIRST_THREAD_45890\\\"\"},\"JAVA_MAIN_CLASS_46108\":{\"value\":\"com.example.demo.DemoApplication\",\"origin\":\"System Environment Property \\\"JAVA_MAIN_CLASS_46108\\\"\"},\"USER\":{\"value\":\"nierajsingh\",\"origin\":\"System Environment Property \\\"USER\\\"\"},\"TMPDIR\":{\"value\":\"/var/folders/hj/ykvzmmmj4wl5tk959bdfss5w0000gp/T/\",\"origin\":\"System Environment Property \\\"TMPDIR\\\"\"},\"SSH_AUTH_SOCK\":{\"value\":\"/private/tmp/com.apple.launchd.Edc0D0QqVQ/Listeners\",\"origin\":\"System Environment Property \\\"SSH_AUTH_SOCK\\\"\"},\"DISPLAY\":{\"value\":\"/private/tmp/com.apple.launchd.8djHo5qh6H/org.macosforge.xquartz:0\",\"origin\":\"System Environment Property \\\"DISPLAY\\\"\"},\"XPC_FLAGS\":{\"value\":\"0x0\",\"origin\":\"System Environment Property \\\"XPC_FLAGS\\\"\"},\"APP_ICON_45890\":{\"value\":\"../Resources/sts4.icns\",\"origin\":\"System Environment Property \\\"APP_ICON_45890\\\"\"},\"JAVA_MAIN_CLASS_46095\":{\"value\":\"org.eclipse.equinox.launcher.Main\",\"origin\":\"System Environment Property \\\"JAVA_MAIN_CLASS_46095\\\"\"},\"__CF_USER_TEXT_ENCODING\":{\"value\":\"0x1F6:0x0:0x52\",\"origin\":\"System Environment Property \\\"__CF_USER_TEXT_ENCODING\\\"\"},\"Apple_PubSub_Socket_Render\":{\"value\":\"/private/tmp/com.apple.launchd.wiuBp605jW/Render\",\"origin\":\"System Environment Property \\\"Apple_PubSub_Socket_Render\\\"\"},\"LOGNAME\":{\"value\":\"nierajsingh\",\"origin\":\"System Environment Property \\\"LOGNAME\\\"\"},\"XPC_SERVICE_NAME\":{\"value\":\"org.springframework.boot.ide.branding.sts4.24084\",\"origin\":\"System Environment Property \\\"XPC_SERVICE_NAME\\\"\"},\"HOME\":{\"value\":\"/Users/nierajsingh\",\"origin\":\"System Environment Property \\\"HOME\\\"\"}}}," + // context path defined in applicationConfi + + "{\"name\":\"applicationConfig: [file:./application.properties]\",\"properties\":{\"server.servlet.contextPath\":{\"value\":\"/pathfromapplicationconfig\",\"origin\":\"URL [file:./application.properties]:1:28\"}}}]}\n"; + + +} diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/RequestMappingLiveHoverTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/RequestMappingLiveHoverTest.java index 9e57f4ec4..f28f7cc06 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/RequestMappingLiveHoverTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/RequestMappingLiveHoverTest.java @@ -326,87 +326,6 @@ public class RequestMappingLiveHoverTest { editor.assertNoHover("@PutMapping(\"/greetings\")"); } - @Test - public void testLiveHoverHintWithContextPath() throws Exception { - - File directory = new File( - ProjectsHarness.class.getResource("/test-projects/test-request-mapping-live-hover/").toURI()); - String docUri = directory.toPath().resolve("src/main/java/example/HelloWorldController.java").toUri() - .toString(); - - // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) - .port("1111") - .processId("22022") - .host("cfapps.io") - .contextPath("/adifferentpath") - .processName("test-request-mapping-live-hover") - // Ugly, but this is real JSON copied from a real live running app. We want the - // mock app to return realistic results if possible - .requestMappingsJson( - "{\"/webjars/**\":{\"bean\":\"resourceHandlerMapping\"},\"/**\":{\"bean\":\"resourceHandlerMapping\"},\"/**/favicon.ico\":{\"bean\":\"faviconHandlerMapping\"},\"{[/hello-world],methods=[GET]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public example.Greeting example.HelloWorldController.sayHello(java.lang.String)\"},\"{[/goodbye]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.goodbye()\"},\"{[/hello]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.hello()\"},\"{[/error]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)\"},\"{[/error],produces=[text/html]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)\"}}") - .build(); - - harness.intialize(directory); - - Editor editor = harness.newEditorFromFileUri(docUri, LanguageId.JAVA); - editor.assertHighlights("@RequestMapping(method=RequestMethod.GET)"); - editor.assertHoverContains("@RequestMapping(method=RequestMethod.GET)", "[http://cfapps.io:1111/adifferentpath/hello-world](http://cfapps.io:1111/adifferentpath/hello-world) \n" + - "\n" + - "Process [PID=22022, name=`test-request-mapping-live-hover`]"); - - } - - @Test - public void testMultiPathMappingWithContextPath() throws Exception { - - File directory = new File( - ProjectsHarness.class.getResource("/test-projects/test-request-mapping-live-hover/").toURI()); - String docUri = directory.toPath().resolve("src/main/java/example/RestApi.java").toUri() - .toString(); - - - // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) - .port("999") - .processId("76543") - .host("cfapps.io") - .contextPath("/differentPaath") - .processName("test-request-mapping-live-hover") - // Ugly, but this is real JSON copied from a real live running app. We want the - // mock app to return realistic results if possible - .requestMappingsJson( - "{\"{[/greetings || /hello],methods=[GET]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public java.lang.String com.example.RestApi.greetings()\"}}") - . build(); - - harness.intialize(directory); - - Editor editor = harness.newEditor(LanguageId.JAVA, - "package com.example;\n" + - "\n" + - "import org.springframework.stereotype.Controller;\n" + - "import org.springframework.web.bind.annotation.RequestMapping;\n" + - "import org.springframework.web.bind.annotation.RequestMethod.*;\n" + - "\n" + - "@Controller\n" + - "public class RestApi {\n" + - "\n" + - "@RequestMapping(value={\"/greetings\", \"/hello\"}, method=GET)\n" + - "public String greetings() {\n" + - "}\n" + - "\n" + - "}", - docUri); - - editor.assertHoverContains("@RequestMapping(value={\"/greetings\", \"/hello\"}, method=GET)", "[http://cfapps.io:999/differentPaath/greetings](http://cfapps.io:999/differentPaath/greetings) \n" + - "[http://cfapps.io:999/differentPaath/hello](http://cfapps.io:999/differentPaath/hello) \n" + - "\n" + - "Process [PID=76543, name=`test-request-mapping-live-hover`]"); - - } - @Test public void testMultiPathMappingHoverHintMethod1() throws Exception { diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/RequestMappingLiveHoverTestWithContextPath.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/RequestMappingLiveHoverTestWithContextPath.java new file mode 100644 index 000000000..e84415ad8 --- /dev/null +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/RequestMappingLiveHoverTestWithContextPath.java @@ -0,0 +1,196 @@ +/******************************************************************************* + * Copyright (c) 2018 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Pivotal, Inc. - initial API and implementation + *******************************************************************************/ +package org.springframework.ide.vscode.boot.java.requestmapping.test; + +import java.io.File; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Import; +import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest; +import org.springframework.ide.vscode.boot.bootiful.HoverTestConf; +import org.springframework.ide.vscode.commons.util.text.LanguageId; +import org.springframework.ide.vscode.languageserver.testharness.Editor; +import org.springframework.ide.vscode.project.harness.BootLanguageServerHarness; +import org.springframework.ide.vscode.project.harness.MockRunningAppProvider; +import org.springframework.ide.vscode.project.harness.ProjectsHarness; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@BootLanguageServerTest +@Import(HoverTestConf.class) +public class RequestMappingLiveHoverTestWithContextPath { + + @Autowired BootLanguageServerHarness harness; + @Autowired MockRunningAppProvider mockAppProvider; + + @Before + public void setup() throws Exception { + harness.useProject(ProjectsHarness.INSTANCE.mavenProject("test-request-mapping-live-hover")); + } + + @Test + public void testActuatorEnvOrderedPropertySourceCamelCase() throws Exception { + // Tests an actuator env json that contains camel case context path in command line arg and application config. + + File directory = new File( + ProjectsHarness.class.getResource("/test-projects/test-request-mapping-live-hover/").toURI()); + String docUri = directory.toPath().resolve("src/main/java/example/HelloWorldController.java").toUri() + .toString(); + + // Build a mock running boot app + mockAppProvider.builder() + .isSpringBootApp(true) + .port("1111") + .processId("22022") + .host("cfapps.io") + .processName("test-request-mapping-live-hover") + // Ugly, but this is real JSON copied from a real live running app. We want the + // mock app to return realistic results if possible + .requestMappingsJson( + "{\"/webjars/**\":{\"bean\":\"resourceHandlerMapping\"},\"/**\":{\"bean\":\"resourceHandlerMapping\"},\"/**/favicon.ico\":{\"bean\":\"faviconHandlerMapping\"},\"{[/hello-world],methods=[GET]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public example.Greeting example.HelloWorldController.sayHello(java.lang.String)\"},\"{[/goodbye]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.goodbye()\"},\"{[/hello]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.hello()\"},\"{[/error]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)\"},\"{[/error],produces=[text/html]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)\"}}") + .contextPathEnvJson("2.x", AcuatorEnvTestConstants.BOOT_2x_ENV_CONTEXT_PATH_CAMEL_CASE) + .build(); + + harness.intialize(directory); + + Editor editor = harness.newEditorFromFileUri(docUri, LanguageId.JAVA); + editor.assertHighlights("@RequestMapping(method=RequestMethod.GET)"); + + // test that the command line arg context path appears + editor.assertHoverContains("@RequestMapping(method=RequestMethod.GET)", "[http://cfapps.io:1111/pathfromcommandlineargs/hello-world](http://cfapps.io:1111/pathfromcommandlineargs/hello-world) \n" + + "\n" + + "Process [PID=22022, name=`test-request-mapping-live-hover`]"); + + } + + @Test + public void testActuatorEnvOrderedPropertySourceKebabCase() throws Exception { + + // Tests an actuator env json that contains kebab case context path in command line arg and application config. + + File directory = new File( + ProjectsHarness.class.getResource("/test-projects/test-request-mapping-live-hover/").toURI()); + String docUri = directory.toPath().resolve("src/main/java/example/HelloWorldController.java").toUri() + .toString(); + + // Build a mock running boot app + mockAppProvider.builder() + .isSpringBootApp(true) + .port("1111") + .processId("22022") + .host("cfapps.io") + .processName("test-request-mapping-live-hover") + // Ugly, but this is real JSON copied from a real live running app. We want the + // mock app to return realistic results if possible + .requestMappingsJson( + "{\"/webjars/**\":{\"bean\":\"resourceHandlerMapping\"},\"/**\":{\"bean\":\"resourceHandlerMapping\"},\"/**/favicon.ico\":{\"bean\":\"faviconHandlerMapping\"},\"{[/hello-world],methods=[GET]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public example.Greeting example.HelloWorldController.sayHello(java.lang.String)\"},\"{[/goodbye]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.goodbye()\"},\"{[/hello]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.hello()\"},\"{[/error]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)\"},\"{[/error],produces=[text/html]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)\"}}") + .contextPathEnvJson("2.x", AcuatorEnvTestConstants.BOOT_2x_ENV_CONTEXT_PATH_KEBAB_CASE) + .build(); + + harness.intialize(directory); + + Editor editor = harness.newEditorFromFileUri(docUri, LanguageId.JAVA); + editor.assertHighlights("@RequestMapping(method=RequestMethod.GET)"); + + // test that the command line arg context path appears + editor.assertHoverContains("@RequestMapping(method=RequestMethod.GET)", "[http://cfapps.io:1111/pathfromcommandlineargs/hello-world](http://cfapps.io:1111/pathfromcommandlineargs/hello-world) \n" + + "\n" + + "Process [PID=22022, name=`test-request-mapping-live-hover`]"); + + } + + + @Test + public void testWithMockedContextPath() throws Exception { + + File directory = new File( + ProjectsHarness.class.getResource("/test-projects/test-request-mapping-live-hover/").toURI()); + String docUri = directory.toPath().resolve("src/main/java/example/HelloWorldController.java").toUri() + .toString(); + + // Build a mock running boot app + mockAppProvider.builder() + .isSpringBootApp(true) + .port("1111") + .processId("22022") + .host("cfapps.io") + .contextPath("/adifferentpath") + .processName("test-request-mapping-live-hover") + // Ugly, but this is real JSON copied from a real live running app. We want the + // mock app to return realistic results if possible + .requestMappingsJson( + "{\"/webjars/**\":{\"bean\":\"resourceHandlerMapping\"},\"/**\":{\"bean\":\"resourceHandlerMapping\"},\"/**/favicon.ico\":{\"bean\":\"faviconHandlerMapping\"},\"{[/hello-world],methods=[GET]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public example.Greeting example.HelloWorldController.sayHello(java.lang.String)\"},\"{[/goodbye]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.goodbye()\"},\"{[/hello]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.hello()\"},\"{[/error]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)\"},\"{[/error],produces=[text/html]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)\"}}") + .build(); + + harness.intialize(directory); + + Editor editor = harness.newEditorFromFileUri(docUri, LanguageId.JAVA); + editor.assertHighlights("@RequestMapping(method=RequestMethod.GET)"); + editor.assertHoverContains("@RequestMapping(method=RequestMethod.GET)", "[http://cfapps.io:1111/adifferentpath/hello-world](http://cfapps.io:1111/adifferentpath/hello-world) \n" + + "\n" + + "Process [PID=22022, name=`test-request-mapping-live-hover`]"); + + } + + @Test + public void testMultiPathMockedContextPath() throws Exception { + + File directory = new File( + ProjectsHarness.class.getResource("/test-projects/test-request-mapping-live-hover/").toURI()); + String docUri = directory.toPath().resolve("src/main/java/example/RestApi.java").toUri() + .toString(); + + + // Build a mock running boot app + mockAppProvider.builder() + .isSpringBootApp(true) + .port("999") + .processId("76543") + .host("cfapps.io") + .contextPath("/differentPaath") + .processName("test-request-mapping-live-hover") + // Ugly, but this is real JSON copied from a real live running app. We want the + // mock app to return realistic results if possible + .requestMappingsJson( + "{\"{[/greetings || /hello],methods=[GET]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public java.lang.String com.example.RestApi.greetings()\"}}") + . build(); + + harness.intialize(directory); + + Editor editor = harness.newEditor(LanguageId.JAVA, + "package com.example;\n" + + "\n" + + "import org.springframework.stereotype.Controller;\n" + + "import org.springframework.web.bind.annotation.RequestMapping;\n" + + "import org.springframework.web.bind.annotation.RequestMethod.*;\n" + + "\n" + + "@Controller\n" + + "public class RestApi {\n" + + "\n" + + "@RequestMapping(value={\"/greetings\", \"/hello\"}, method=GET)\n" + + "public String greetings() {\n" + + "}\n" + + "\n" + + "}", + docUri); + + editor.assertHoverContains("@RequestMapping(value={\"/greetings\", \"/hello\"}, method=GET)", "[http://cfapps.io:999/differentPaath/greetings](http://cfapps.io:999/differentPaath/greetings) \n" + + "[http://cfapps.io:999/differentPaath/hello](http://cfapps.io:999/differentPaath/hello) \n" + + "\n" + + "Process [PID=76543, name=`test-request-mapping-live-hover`]"); + + } + + +} diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/project/harness/MockRunningAppProvider.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/project/harness/MockRunningAppProvider.java index 3e6681ff8..eb97d9ca0 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/project/harness/MockRunningAppProvider.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/project/harness/MockRunningAppProvider.java @@ -10,7 +10,6 @@ *******************************************************************************/ package org.springframework.ide.vscode.project.harness; -import static org.mockito.Matchers.anyObject; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -19,6 +18,7 @@ import java.util.Collection; import org.mockito.Mockito; import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; +import org.springframework.ide.vscode.commons.boot.app.cli.ContextPath; import org.springframework.ide.vscode.commons.boot.app.cli.LocalSpringBootApp; import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp; import org.springframework.ide.vscode.commons.boot.app.cli.livebean.LiveBeansModel; @@ -66,11 +66,6 @@ public class MockRunningAppProvider { this.runningAppProvider = runningAppProvider; } - public MockAppBuilder enviroment(String env) throws Exception { - when(app.getEnvironment()).thenReturn(env); - return this; - } - public MockAppBuilder beans(String beans) throws Exception { return beans(LiveBeansModel.parse(beans)); } @@ -97,6 +92,12 @@ public class MockRunningAppProvider { return this; } + public MockAppBuilder contextPathEnvJson(String bootVersion, String envJson) throws Exception { + String contextPath = ContextPath.getContextPath(bootVersion, envJson); + when(app.getContextPath()).thenReturn(contextPath); + return this; + } + public MockAppBuilder port(String port) throws Exception { when(app.getPort()).thenReturn(port); return this;