diff --git a/headless-services/commons/commons-boot-app-cli/pom.xml b/headless-services/commons/commons-boot-app-cli/pom.xml deleted file mode 100644 index 084da2c7b..000000000 --- a/headless-services/commons/commons-boot-app-cli/pom.xml +++ /dev/null @@ -1,70 +0,0 @@ - - 4.0.0 - commons-boot-app-cli - commons-boot-app-cli - Common code related to 'accessing running boot apps in a cli-like style' - - - org.springframework.ide.vscode - commons-parent - 1.12.0-SNAPSHOT - ../pom.xml - - - - - org.json - json - 20160810 - - - commons-io - commons-io - ${commons-io-version} - - - commons-codec - commons-codec - - - - commons-util - org.springframework.ide.vscode - ${project.version} - - - commons-java - org.springframework.ide.vscode - ${project.version} - - - org.ow2.asm - asm - 6.1.1 - - - - - - tools-jar-profile - - - ${java.home}/../lib/tools.jar - - - - - - com.sun - tools - 1.8.0 - system - ${java.home}/../lib/tools.jar - - - - - - diff --git a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/AbstractSpringBootApp.java b/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/AbstractSpringBootApp.java deleted file mode 100644 index 587899852..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/AbstractSpringBootApp.java +++ /dev/null @@ -1,722 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018, 2019 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.vscode.commons.boot.app.cli; - -import java.io.File; -import java.io.IOException; -import java.lang.management.ManagementFactory; -import java.lang.management.PlatformManagedObject; -import java.time.Duration; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Optional; -import java.util.Properties; -import java.util.Set; -import java.util.StringTokenizer; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; - -import javax.management.InstanceNotFoundException; -import javax.management.MBeanServerConnection; -import javax.management.ObjectName; -import javax.management.Query; -import javax.management.QueryExp; -import javax.management.remote.JMXConnector; -import javax.management.remote.JMXConnectorFactory; -import javax.management.remote.JMXServiceURL; - -import org.apache.commons.codec.digest.DigestUtils; -import org.json.JSONArray; -import org.json.JSONObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.ide.vscode.boot.java.livehover.v2.Boot1xRequestMapping; -import org.springframework.ide.vscode.boot.java.livehover.v2.ContextPath; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBeansModel; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveConditional; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveConditionalParser; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveProperties; -import org.springframework.ide.vscode.boot.java.livehover.v2.LivePropertiesJsonParser; -import org.springframework.ide.vscode.boot.java.livehover.v2.RequestMapping; -import org.springframework.ide.vscode.boot.java.livehover.v2.RequestMappingsParser20; -import org.springframework.ide.vscode.commons.util.AsyncRunner; -import org.springframework.ide.vscode.commons.util.ExceptionUtil; -import org.springframework.ide.vscode.commons.util.FuctionWithException; -import org.springframework.ide.vscode.commons.util.FunctionWithException; -import org.springframework.ide.vscode.commons.util.MemoizingDisposableSupplier; -import org.springframework.ide.vscode.commons.util.StringUtil; - -import com.google.common.cache.Cache; -import com.google.common.cache.CacheBuilder; -import com.google.common.collect.ImmutableList; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import reactor.core.scheduler.Schedulers; - -/** - * A abstract base class which attempts to capture commonalities between - * Local and Remote connections to SpringBootApp using JMX. - */ -public abstract class AbstractSpringBootApp implements SpringBootApp { - - private static final Duration TIMEOUT = Duration.ofMillis(1000); - private static final Duration TIMEOUT_CHECKFORSPRINGAPPS = Duration.ofSeconds(3); - - protected static AsyncRunner async = new AsyncRunner(Schedulers.elastic()); - private static final String SPRINGFRAMEWORK_BOOT_DOMAIN = "org.springframework.boot"; - protected static Logger logger = LoggerFactory.getLogger(SpringBootApp.class); - - private String jmxMbeanActuatorDomain; - - private Set nonBootLiveMBeanNames; - private Boolean hasJmxBeans; - private int retryCount; - - private LiveBeansModel cachedBeansModel; - private String cachedBeansModelMD5; - - private Cache beansModelCache = CacheBuilder.newBuilder() - .expireAfterWrite(3, TimeUnit.SECONDS) - .build(); - - // NOTE: Gson-based serialisation replaces the old Jackson ObjectMapper. Not sure if this makes a difference in the long run, but to retain the same output that Jackson Object Mapper - // was generating during serialisation, some configuration in Gson is required, as the default behaviour of Gson is different than Object Mapper. - // Namely: Object Mapper does not escape Html, whereas Gson does by default (for example - // '=' in Gson appears as '\u003d') - protected final Gson gson = new GsonBuilder() - .disableHtmlEscaping() - .create(); - - protected abstract String getJmxUrl(); - - @Override - public abstract Properties getSystemProperties() throws Exception; - - @Override - public abstract String getProcessID(); - - @Override - public abstract String getProcessName() throws Exception; - - - protected static T withTimeout(Callable doit) throws Exception { - return withTimeout(TIMEOUT, doit); - } - - protected static T withTimeout(Duration timeout, Callable doit) throws Exception { - return async.invoke(timeout, doit).get(); - } - - private final MemoizingDisposableSupplier jmxConnector = new MemoizingDisposableSupplier( - //creating jmx connector: - () -> { - String url = getJmxUrl(); - logger.info("Creating JMX connector: "+url); - try { - if (url==null) { - throw new IOException("Couldn't obtain JMX url"); - } - JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(url), null); - logger.info("Created JMX connector: {}", connector); - return connector; - } catch (Exception e) { - logger.info("Creating JMX connector failed: {}", ExceptionUtil.getMessage(e)); - throw e; - } - }, - //disposing jmx connector: - (connector) -> { - logger.info("Disposing JMX connector: "+connector); - AsyncRunner.thenLog(logger, async.invoke(TIMEOUT, () -> { - try { - connector.close(); - } catch (java.rmi.ConnectException e) { - //Ignore. - } - return "done"; - })); - } - ); - - protected T withJmxConnector(FunctionWithException doit) throws Exception { - try { - return doit.apply(jmxConnector.get()); - } catch (Exception e) { - logger.info("Evicting JMX connector {} because of error: {}", jmxConnector, ExceptionUtil.getMessage(e)); - jmxConnector.evict(); - throw e; - } - } - - @Override - public void dispose() { - jmxConnector.dispose(); - } - - public boolean containsSystemProperty(Object key) throws Exception { - Properties props = getSystemProperties(); - return props.containsKey(key); - } - - @Override - public List getActiveProfiles() { - try { - String _env = getEnvironment(); - if (_env != null) { - JSONObject env = new JSONObject(_env); - Object _profiles = env.opt("activeProfiles"); //Boot 2.0 - if (_profiles==null) { - _profiles = env.opt("profiles"); //Boot 1.5 - } - if (_profiles instanceof JSONArray) { - JSONArray profiles = (JSONArray) _profiles; - ImmutableList.Builder list = ImmutableList.builder(); - for (Object object : profiles) { - if (object instanceof String) { - list.add((String) object); - } - } - return list.build(); - } - } - } catch (Exception e) { - logger.error("error resolving profiles from env", e); - } - return null; - } - - @Override - public Collection getRequestMappings() throws Exception { - try { - //Boot 1.x - Object result = getActuatorDataFromAttribute(getObjectName("type=Endpoint,name=requestMappingEndpoint"), "Data"); - if (result != null) { - String mappings = gson.toJson(result); - return parseRequestMappingsJson(mappings, "1.x"); - } - - //Boot 2.x - result = getActuatorDataFromOperation(getObjectName("type=Endpoint,name=Mappings"), "mappings"); - if (result != null) { - String mappings = gson.toJson(result); - return parseRequestMappingsJson(mappings, "2.x"); - } - } catch (IOException e) { - //ignore.. app stopped - } catch (ExecutionException e) { - if (!(e.getCause() instanceof IOException)) { - throw e; - } - } - return null; - } - - public static Collection parseRequestMappingsJson(String json, String bootVersion) { - JSONObject obj = new JSONObject(json); - if (bootVersion.equals("2.x")) { - return RequestMappingsParser20.parse(obj); - } else { //1.x - List result = new ArrayList<>(); - Iterator keys = obj.keys(); - while (keys.hasNext()) { - String rawKey = keys.next(); - JSONObject value = obj.getJSONObject(rawKey); - result.add(new Boot1xRequestMapping(rawKey, value)); - } - return result; - } - } - - @Override - public boolean hasUsefulJmxBeans() { - if (hasJmxBeans == null) { - try { - if (containsSystemProperty("sts4.languageserver.name")) { - logger.info("language server process found -- " + this.toString()); - hasJmxBeans = Boolean.FALSE; - } - else { - logger.info("check for spring jmx beans (retry no. " + retryCount + ") -- " + this.toString()); - - boolean jmxBeansFound = containsSpringJmxBeans(); - if (jmxBeansFound) { - hasJmxBeans = Boolean.TRUE; - logger.info("spring jmx beans found -- " + this.toString()); - } - else if (retryCount == 3) { - hasJmxBeans = Boolean.FALSE; - logger.info("no spring jmx beans found after trying 4 times -- " + this.toString()); - } - else { - retryCount++; - } - } - } - catch (Exception e) { - if (retryCount == 3) { - hasJmxBeans = Boolean.FALSE; - - try { - logger.info("no spring jmx beans found after trying 4 times -- " + this.toString()); - } catch (Exception e1) { - logger.info("no spring jmx beans found after trying 4 times -- " + this.toString()); - } - } - else { - retryCount++; - } - } - } - - return hasJmxBeans != null ? hasJmxBeans : false; - } - - protected boolean containsSpringJmxBeans() throws Exception { - return withTimeout(TIMEOUT_CHECKFORSPRINGAPPS, () -> withJmxConnector(jmxConnector -> { - MBeanServerConnection connection = jmxConnector.getMBeanServerConnection(); - - QueryExp queryExp = Query.or(Query.or(Query.isInstanceOf(Query.value("org.springframework.boot.actuate.endpoint.jmx.EndpointMBean")), - Query.isInstanceOf(Query.value("org.springframework.boot.actuate.endpoint.jmx.DataEndpointMBean"))), - Query.isInstanceOf(Query.value("org.springframework.context.support.LiveBeansView"))); - - Set names = connection.queryNames(null, queryExp); - return names != null && names.size() > 0; - })); - } - - protected boolean providesNonBootLiveBeans() { - return getNonBootSpringLiveMBeans().size() > 0; - } - - protected Set getNonBootSpringLiveMBeans() { - if (this.nonBootLiveMBeanNames == null) { - try { - this.nonBootLiveMBeanNames = withTimeout(() -> withJmxConnector(jmxConnector -> { - MBeanServerConnection connection = jmxConnector.getMBeanServerConnection(); - QueryExp queryExp = Query.isInstanceOf(Query.value("org.springframework.context.support.LiveBeansView")); - return connection.queryNames(null, queryExp); - })); - } catch (Exception e) { - e.printStackTrace(); - this.nonBootLiveMBeanNames = Collections.emptySet(); - } - } - - return this.nonBootLiveMBeanNames; - } - - protected ObjectName getObjectName(String keyProperties) throws Exception { - String domain = getDomainForActuator(); - return getObjectName(domain, keyProperties); - } - - protected ObjectName getObjectName(String domain, String keyProperties) throws Exception { - if (StringUtil.hasText(domain) && StringUtil.hasText(keyProperties)) { - String fullName = domain + ":" + keyProperties; - return ObjectName.getInstance(fullName); - } - return null; - } - - @Override - public LiveBeansModel getBeans() { - try { - return beansModelCache.get("liveBeans", () -> { - Object json = null; - - try { - String domain = getDomainForActuator(); - json = getBeansFromActuator(domain); - - if (json == null && this.providesNonBootLiveBeans()) { - json = getBeansFromNonBootMBean(); - } - } catch (IOException e) { - // PT 160096886 - Don't throw exception, as actuator info will not be available when app stopping, and - // this is not an error condition. Return empty model instead. - } catch (ExecutionException e) { - if (!(e.getCause() instanceof IOException)) { - throw e; - } - } - if (json != null) { - String md5 = DigestUtils.md5Hex(json.toString()); - - synchronized(AbstractSpringBootApp.this) { - if (cachedBeansModel == null || !md5.equals(cachedBeansModelMD5)) { - - if (json instanceof String) { - cachedBeansModel = LiveBeansModel.parse((String)json); - } - else { - cachedBeansModel = LiveBeansModel.parse(gson.toJson(json)); - } - - cachedBeansModelMD5 = md5; - logger.debug("Got {} beans for {}", cachedBeansModel.getBeanNames().size(), this); - } else { - logger.debug("Got {} beans for {} - from cache", cachedBeansModel.getBeanNames().size(), this); - } - } - - return cachedBeansModel; - - } else { - // PT 160096886 - Don't throw exception, as actuator info will not be available when app stopping, and - // this is not an error condition. Return empty model instead. - return LiveBeansModel.builder().build(); - } - - }); - } catch (Exception e) { - logger.error("Error parsing beans", e); - return LiveBeansModel.builder().build(); - } - } - - protected Object getBeansFromNonBootMBean() throws Exception { - Set nonBootSpringLiveMBeans = getNonBootSpringLiveMBeans(); - if (nonBootSpringLiveMBeans.size() > 0) { - return getActuatorDataFromAttribute(nonBootSpringLiveMBeans.iterator().next(), "SnapshotAsJson"); - } - else { - return null; - } - } - - private Object getBeansFromActuator(String domain) throws Exception { - Object result = getActuatorDataFromOperation(getObjectName(domain, "type=Endpoint,name=Beans"), "beans"); - if (result != null) return result; - - return getActuatorDataFromAttribute(getObjectName(domain, "type=Endpoint,name=beansEndpoint"), "Data"); - } - - /** - * PT 156072399: Actuator information can be defined using a different JMX MBean domain. - * By default, Spring Boot exposes management endpoints as JMX MBeans under the 'org.springframework.boot' domain. - * Users can however define another domain in the app's application.properties, for example using this property: - * management.endpoints.jmx.domain=com.example.myapp - * - * Therefore we need to support other domains than just: 'org.springframework.boot' - * @return JMX MBean domain containing actuator information, or null if not resolved. - * @throws Exception when resolving domain from JMX - */ - protected String getDomainForActuator() throws Exception { - if (this.jmxMbeanActuatorDomain == null) { - this.jmxMbeanActuatorDomain = withJmxConnector(jmxConnector -> { - String jmxMbeanActuatorDomain = null; - MBeanServerConnection connection = jmxConnector.getMBeanServerConnection(); - // To be more efficient in finding the domain containing actuator information, - // and avoid many JMX connections - // first check the default springframework boot domain: - Object beansJson = getBeansFromActuator(SPRINGFRAMEWORK_BOOT_DOMAIN); - if (beansJson != null) { - jmxMbeanActuatorDomain = SPRINGFRAMEWORK_BOOT_DOMAIN; - } - - if (jmxMbeanActuatorDomain == null) { - String[] domains = connection.getDomains(); - if (domains != null) { - for (String domain : domains) { - // we already checked default boot domain, no need to check it again - // Note that default spring boot domain may still appear even if another - // domain contains actuator Beans (for example, "Admin" will be under default spring framework domain) - if (!SPRINGFRAMEWORK_BOOT_DOMAIN.equals(domain)) { - beansJson = getBeansFromActuator(domain); - if (beansJson != null) { - jmxMbeanActuatorDomain = domain; - break; - } - } - } - } - } - return jmxMbeanActuatorDomain; - }); - } - return this.jmxMbeanActuatorDomain; - } - - protected R withPlatformMxBean(Class mbeanType, FuctionWithException doit) throws Exception { - return withJmxConnector(jmxConnector -> { - MBeanServerConnection connection = jmxConnector.getMBeanServerConnection(); - T proxy = ManagementFactory.getPlatformMXBean(connection, mbeanType); - return doit.apply(proxy); - }); - } - - protected Object getActuatorDataFromAttribute(ObjectName objectName, String attribute) throws Exception { - if (objectName != null) { - return withJmxConnector(jmxConnector -> { - try { - MBeanServerConnection connection = jmxConnector.getMBeanServerConnection(); - return connection.getAttribute(objectName, attribute); - } catch (InstanceNotFoundException|IOException e) { - return null; - } - }); - } - return null; - } - - protected Object getActuatorDataFromOperation(ObjectName objectName, String operation) throws Exception { - if (objectName != null) { - return withJmxConnector(jmxConnector -> { - try { - MBeanServerConnection connection = jmxConnector.getMBeanServerConnection(); - return connection.invoke(objectName, operation, null, null); - } catch (InstanceNotFoundException|IOException e) { - return null; - } - }); - } - return null; - } - - @Override - public String getEnvironment() throws Exception { - try { - Object result = getActuatorDataFromAttribute(getObjectName("type=Endpoint,name=environmentEndpoint"), "Data"); - if (result != null) { - String environment = gson.toJson(result); - return environment; - } - - result = getActuatorDataFromOperation(getObjectName("type=Endpoint,name=Env"), "environment"); - if (result != null) { - String environment = gson.toJson(result); - return environment; - } - } catch (IOException e) { - //ignore... probably just because app is stopped - } catch (ExecutionException e) { - if (!(e.getCause() instanceof IOException)) { - throw e; - } - } - return null; - } - - @Override - public String[] getClasspath() throws Exception { - Properties props = getSystemProperties(); - String classpath = (String) props.get("java.class.path"); - String[] cpElements = splitClasspath(classpath); - return cpElements; - } - - private String[] splitClasspath(String classpath) { - List classpathElements = new ArrayList<>(); - if (classpath != null) { - StringTokenizer tokenizer = new StringTokenizer(classpath, File.pathSeparator); - while (tokenizer.hasMoreTokens()) { - String classpathElement = tokenizer.nextToken(); - classpathElements.add(classpathElement); - } - } - return classpathElements.toArray(new String[classpathElements.size()]); - } - - @Override - public String getJavaCommand() throws Exception { - Properties props = getSystemProperties(); - return (String) props.get("sun.java.command"); - } - - @Override - public String getHost() throws Exception { - //TODO: different implementation for cf apps with locally tunnelled - // jmx connection? - try { - JMXServiceURL serviceUrl = new JMXServiceURL(getJmxUrl()); - return serviceUrl.getHost(); - } catch (Exception e) { - return "Unknown host"; - } - } - - @Override - public Optional> getLiveConditionals() throws Exception { - return getLiveConditionals(getAutoConfigReport(), getProcessID(), getProcessName()); - } - - @Override - public String getContextPath() throws Exception { - try { - String environment = getEnvironment(); - String bootVersion = null; - // Boot 1.x - Object result = getActuatorDataFromAttribute(getObjectName("type=Endpoint,name=requestMappingEndpoint"), "Data"); - if (result != null) { - bootVersion = "1.x"; - } - - // Boot 2.x - result = getActuatorDataFromOperation(getObjectName("type=Endpoint,name=Mappings"), "mappings"); - if (result != null) { - bootVersion = "2.x"; - } - return bootVersion != null && environment != null ? ContextPath.getContextPath(bootVersion, environment) : null; - } catch (IOException e) { - //Ignore... happens a low when app is stopped - } catch (ExecutionException e) { - if (!(e.getCause() instanceof IOException)) { - throw e; - } - } - return null; - } - - /** - * Publicly visible so that it can be tested via a mock app - * - * @param autoConfigReport - * @param processId - * @param processName - * @return - * @throws Exception - */ - public static Optional> getLiveConditionals(String autoConfigReport, String processId, - String processName) { - return LiveConditionalParser.parse(autoConfigReport, processId, processName); - } - - private String getAutoConfigReport() throws Exception { - try { - //Boot 1.x - Object result = getActuatorDataFromAttribute(getObjectName("type=Endpoint,name=autoConfigurationReportEndpoint"), "Data"); - if (result != null) { - String report = gson.toJson(result); - return report; - } - - //Boot 2.x - result = getActuatorDataFromOperation(getObjectName("type=Endpoint,name=Conditions"), "applicationConditionEvaluation"); - if (result != null) { - String report = gson.toJson(result); - return report; - } - } catch (IOException e) { - //ignore. Happens a lot when apps are stopped while we try to talk to them. - } - - return null; - } - - @Override - public String getPort() throws Exception { - return withJmxConnector(jmxConnector -> { - MBeanServerConnection connection = jmxConnector.getMBeanServerConnection(); - - String port = getPortViaAdmin(connection); - if (port != null) { - return port; - } - - port = getPortViaActuator(connection); - if (port != null) { - return port; - } - - port = getPortViaTomcatBean(connection); - return port; - }); - } - - @Override - public LiveProperties getLiveProperties() throws Exception { - - try { - String envJson = getEnvironment(); - if (envJson != null) { - return LivePropertiesJsonParser.parseProperties(envJson); - } - } catch (Exception e) { - logger.error("error resolving live properties from environment endpoint", e); - } - return null; - } - - protected String getPortViaAdmin(MBeanServerConnection connection) throws Exception { - try { - String DEFAULT_OBJECT_NAME = "org.springframework.boot:type=Admin,name=SpringApplication"; - ObjectName objectName = new ObjectName(DEFAULT_OBJECT_NAME); - - Object o = connection.invoke(objectName,"getProperty", new String[] {"local.server.port"}, new String[] {String.class.getName()}); - return o==null ? null : o.toString(); - } - catch (InstanceNotFoundException e) { - return null; - } - } - - protected String getPortViaActuator(MBeanServerConnection connection) throws Exception { - String environment = getEnvironment(); - if (environment != null) { - JSONObject env = new JSONObject(environment); - if (env != null) { - JSONObject portsObject = env.optJSONObject("server.ports"); - if (portsObject != null) { - String portValue = portsObject.optString("local.server.port"); - if (portValue!=null) { - return portValue; - } - } - //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 ("server.ports".equals(sourceName)) { - JSONObject props = source.optJSONObject("properties"); - JSONObject valueObject = props.optJSONObject("local.server.port"); - if (valueObject!=null) { - String portValue = valueObject.optString("value"); - if (portValue!=null) { - return portValue; - } - } - } - } - } - } - } - } - return null; - } - - protected String getPortViaTomcatBean(MBeanServerConnection connection) throws Exception { - try { - Set queryNames = connection.queryNames(null, null); - - for (ObjectName objectName : queryNames) { - if (objectName.toString().startsWith("Tomcat") && objectName.toString().contains("type=Connector")) { - Object result = connection.getAttribute(objectName, "localPort"); - if (result != null) { - return result.toString(); - } - } - } - } - catch (InstanceNotFoundException e) { - } - return null; - } - -} diff --git a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/LocalSpringBootApp.java b/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/LocalSpringBootApp.java deleted file mode 100644 index 7d18fadd2..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/LocalSpringBootApp.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017, 2019 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.vscode.commons.boot.app.cli; - -import java.io.IOException; -import java.util.Collection; -import java.util.Map.Entry; -import java.util.Properties; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.ide.vscode.commons.util.CollectorUtil; -import org.springframework.ide.vscode.commons.util.ExceptionUtil; - -import com.sun.tools.attach.AttachNotSupportedException; -import com.sun.tools.attach.VirtualMachine; -import com.sun.tools.attach.VirtualMachineDescriptor; - -/** - * @author Martin Lippert - */ -public class LocalSpringBootApp extends AbstractSpringBootApp { - - private static final Logger logger = LoggerFactory.getLogger(LocalSpringBootApp.class); - - private VirtualMachine vm; - private VirtualMachineDescriptor vmd; - - private static final String LOCAL_CONNECTOR_ADDRESS = "com.sun.management.jmxremote.localConnectorAddress"; - - private static LocalSpringBootAppCache cache = new LocalSpringBootAppCache(); - - public static Collection getAllRunningJavaApps() throws Exception { - return cache.getAllRunningJavaApps(); - } - - public static Collection getAllRunningSpringApps() throws Exception { - return getAllRunningJavaApps().parallelStream().filter(app -> app.hasUsefulJmxBeans()).collect(CollectorUtil.toImmutableList()); - } - - public LocalSpringBootApp(VirtualMachineDescriptor vmd) throws AttachNotSupportedException, IOException { - try { - this.vm = VirtualMachine.attach(vmd); - this.vmd = vmd; - } catch (IOException | AttachNotSupportedException e) { - // Dispose JMX connection before throwing exception - dispose(); - throw e; - } - } - - - @Override - protected String getJmxUrl() { - String address = null; - try { - address = withTimeout(() -> vm.getAgentProperties().getProperty(LOCAL_CONNECTOR_ADDRESS)); - } catch (Exception e) { - //ignore - } - if (address==null) { - try { - address = withTimeout(() -> vm.startLocalManagementAgent()); - } catch (Exception e) { - logger.error("Error starting local management agent", e); - } - } - return address; - } - - @Override - public String getProcessID() { - return vmd.id(); - } - - @Override - public String getProcessName() { - String rawName = vmd.displayName(); - int firstSpace = rawName.indexOf(' '); - return firstSpace < 0 ? rawName : rawName.substring(0, firstSpace); - } - - @Override - public Properties getSystemProperties() throws Exception { - try { - return withTimeout(() -> vm.getSystemProperties()); - } catch (Exception e) { - logger.error("Fetching systemprops from local app failed: {}", ExceptionUtil.getMessage(e)); - throw e; - } - } - - protected boolean contains(String[] cpElements, String element) { - for (String cpElement : cpElements) { - if (cpElement.contains(element)) { - return true; - } - } - return false; - } - - @Override - public String toString() { - return "LocalSpringBootApp [id=" +getProcessID() + ", name=`"+getProcessName()+"`]"; - } - - /** - * For testing / investigation purposes. Dumps out as much information as possible - * that can be onbtained from the jvm, without accessing JMX. - */ - public void dumpJvmInfo() throws IOException { - System.out.println("--- vm infos ----"); - System.out.println("id = "+vm.id()); - System.out.println("displayName = "+vmd.displayName()); - dump("agentProperties", vm.getAgentProperties()); - dump("systemProps", vm.getSystemProperties()); - System.out.println("-----------------"); - } - - private void dump(String name, Properties props) { - System.out.println(name + " = {"); - for (Entry prop : props.entrySet()) { - System.out.println(" "+prop.getKey()+" = "+prop.getValue()); - } - System.out.println("}"); - } - - @Override - public void dispose() { - if (vm!=null) { - logger.info("SpringBootApp disposed: "+this); - try { - withTimeout(() -> { vm.detach(); return null; }); - } catch (Exception e) { - } - vm = null; - } - if (vmd!=null) { - vmd = null; - } - super.dispose(); - } - - @Override - public String getUrlScheme() throws Exception { - return "http"; - } -} diff --git a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/LocalSpringBootAppCache.java b/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/LocalSpringBootAppCache.java deleted file mode 100644 index 8d430d31d..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/LocalSpringBootAppCache.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017, 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 - * https://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.commons.boot.app.cli; - -import java.time.Duration; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; - -import org.springframework.ide.vscode.commons.util.MemoizingProxy; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.sun.tools.attach.VirtualMachine; -import com.sun.tools.attach.VirtualMachineDescriptor; - -@SuppressWarnings("restriction") -public class LocalSpringBootAppCache { - - private static final Duration EXPIRE_AFTER = Duration.ofMillis(500); //Limits rate at which we refresh list of apps - private long nextRefreshAfter = Long.MIN_VALUE; - private final MemoizingProxy.Builder memoizingProxyBuilder = MemoizingProxy.builder(LocalSpringBootApp.class, Duration.ofMillis(4500), VirtualMachineDescriptor.class); - - private ImmutableMap apps = ImmutableMap.of(); - - public synchronized Collection getAllRunningJavaApps() { - if (System.currentTimeMillis()>=nextRefreshAfter) { - refresh(); - } - return ImmutableList.copyOf(apps.values()); - } - - private void refresh() { - List currentVms = VirtualMachine.list(); - ImmutableMap.Builder newAppsBuilder = ImmutableMap.builder(); - for (VirtualMachineDescriptor vm : currentVms) { - SpringBootApp existingApp = apps.get(vm); - if (existingApp!=null) { - newAppsBuilder.put(vm, existingApp); - } else { - try { - LocalSpringBootApp localApp = memoizingProxyBuilder.newInstance(vm); - newAppsBuilder.put(vm, localApp); - } catch (Exception e) { - //Ignore problems attaching to a VM. We will try again on next polling loop, if vm still exists. - //The most likely cause is that the VM already died since we obtained a reference to it. - } - } - } - HashSet oldVms = new HashSet<>(apps.keySet()); - ImmutableMap newApps = newAppsBuilder.build(); - oldVms.removeAll(newApps.keySet()); - for (VirtualMachineDescriptor oldVm : oldVms) { - apps.get(oldVm).dispose(); - } - apps = newApps; - nextRefreshAfter = System.currentTimeMillis() + EXPIRE_AFTER.toMillis(); - } - -} diff --git a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/RemoteSpringBootApp.java b/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/RemoteSpringBootApp.java deleted file mode 100644 index af06e67c3..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/RemoteSpringBootApp.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018, 2019 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.vscode.commons.boot.app.cli; - -import java.io.IOException; -import java.lang.management.RuntimeMXBean; -import java.time.Duration; -import java.util.Map.Entry; -import java.util.Properties; - -import org.springframework.ide.vscode.commons.util.MemoizingProxy; - -public class RemoteSpringBootApp extends AbstractSpringBootApp { - - private static MemoizingProxy.Builder memoizingProxyBuilder = MemoizingProxy.builder(RemoteSpringBootApp.class, Duration.ofMillis(4900), - String.class, String.class, String.class, String.class, boolean.class - ); - - private final String jmxUrl; - private final String host; - private final String port; - private final String urlScheme; - private boolean keepChecking; - - public static SpringBootApp create(String jmxUrl, String host, String port, String urlScheme, boolean keepChecking) { - return memoizingProxyBuilder.newInstance(jmxUrl, host, port, urlScheme, keepChecking); - } - - protected RemoteSpringBootApp(String jmxUrl, String host, String port, String urlScheme, boolean keepChecking) { - this.jmxUrl = jmxUrl; - this.host = host; - this.port = port; - this.urlScheme = urlScheme; - this.keepChecking = keepChecking; - } - - @Override - protected String getJmxUrl() { - return jmxUrl; - } - - @Override - public String getPort() throws Exception { - return port != null ? port : super.getPort(); - } - - @Override - public String getHost() throws Exception { - if (host != null) { - return host; - } - return super.getHost(); - } - - @Override - public Properties getSystemProperties() throws Exception { - return withPlatformMxBean(RuntimeMXBean.class, runtime -> { - Properties props = new Properties(); - for (Entry e : runtime.getSystemProperties().entrySet()) { - props.put(e.getKey(), e.getValue()); - } - return props; - }); - } - - @Override - public String getProcessID() { - try { - return withPlatformMxBean(RuntimeMXBean.class, runtime -> runtime.getName()); - } catch (Exception e) { - return null; - } - } - - @Override - public String getProcessName() throws Exception { - try { - String command = getJavaCommand(); - if (command != null) { - int space = command.indexOf(' '); - if (space >= 0) { - command = command.substring(0, space); - } - command = command.trim(); - if (!"".equals(command)) { - return command; - } - } - } catch (IOException e) { - logger.error("", e); - } - return "Unknown"; - } - - @Override - public String getUrlScheme() { - return urlScheme; - } - - @Override - public boolean hasUsefulJmxBeans() { - if (keepChecking) { - try { - logger.info("checking for spring jmx beans, continuously trying -- " + this.toString()); - return super.containsSpringJmxBeans(); - } - catch (Exception e) { - logger.info("no spring jmx beans found, continuously trying -- " + this.toString()); - return false; - } - } - else { - return super.hasUsefulJmxBeans(); - } - } - -} diff --git a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/SpringBootApp.java b/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/SpringBootApp.java deleted file mode 100644 index 48e79fe48..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/SpringBootApp.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018, 2019 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.vscode.commons.boot.app.cli; - -import java.util.Collection; -import java.util.List; -import java.util.Optional; -import java.util.Properties; - -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBeansModel; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveConditional; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveProperties; -import org.springframework.ide.vscode.boot.java.livehover.v2.RequestMapping; - -import reactor.core.Disposable; - -public interface SpringBootApp extends Disposable { - - String[] getClasspath() throws Exception; - String getJavaCommand() throws Exception; - String getProcessName() throws Exception; - String getProcessID(); - String getHost() throws Exception; - String getPort() throws Exception; - String getUrlScheme() throws Exception; - String getContextPath() throws Exception; - - boolean hasUsefulJmxBeans(); - - String getEnvironment() throws Exception; - Collection getRequestMappings() throws Exception; - - LiveBeansModel getBeans(); - - List getActiveProfiles(); - Optional> getLiveConditionals() throws Exception; - Properties getSystemProperties() throws Exception; - - LiveProperties getLiveProperties() throws Exception; - - default String getSystemProperty(String string) throws Exception { - Object r = getSystemProperties().get(string); - if (r instanceof String) { - return (String) r; - } - return null; - } -} diff --git a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/SpringBootAppCLI.java b/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/SpringBootAppCLI.java deleted file mode 100644 index e7a4841da..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/main/java/org/springframework/ide/vscode/commons/boot/app/cli/SpringBootAppCLI.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017, 2019 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.vscode.commons.boot.app.cli; - -import java.util.Collection; - -/** - * @author Martin Lippert - */ -public class SpringBootAppCLI { - - public static void main(String[] args) throws Exception { - Collection allRunningJavaApps = LocalSpringBootApp.getAllRunningJavaApps(); - for (SpringBootApp app : allRunningJavaApps) { - if (app.hasUsefulJmxBeans()) { - printBootAppDetails(app); - } - } - } - - private static void printBootAppDetails(SpringBootApp app) throws Exception { - System.out.println("Spring Boot App: " + app.getProcessID()); - System.out.println("Name: " + app.getProcessName()); - System.out.println("Port: " + app.getPort()); -// System.out.println("Beans: " + app.getBeans()); -// System.out.println("Mappings: " + app.getRequestMappings()); -// System.out.println("ConfigReport: " + app.getLiveConditionals()); - System.out.println(); - } - -} diff --git a/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/Boot1xRequestMappingTest.java b/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/Boot1xRequestMappingTest.java deleted file mode 100644 index a27feb434..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/Boot1xRequestMappingTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 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.vscode.commons.boot.app.cli; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.springframework.ide.vscode.boot.java.livehover.v2.AbstractRequestMapping; -import org.springframework.ide.vscode.boot.java.livehover.v2.Boot1xRequestMapping; - -/** - * @author Martin Lippert - */ -public class Boot1xRequestMappingTest { - - @Test - public void testSplitPathWithoutDuplicate() { - AbstractRequestMapping rm = new Boot1xRequestMapping("/superpath", null); - String[] splitPath = rm.getSplitPath(); - assertEquals(1, splitPath.length); - assertEquals("/superpath", splitPath[0]); - } - - @Test - public void testSplitPathSimpleCaseWithEmptyOr() { - AbstractRequestMapping rm = new Boot1xRequestMapping("/superpath/mypath || ", null); - String[] splitPath = rm.getSplitPath(); - assertEquals(1, splitPath.length); - assertEquals("/superpath/mypath", splitPath[0]); - } - - @Test - public void testSplitPathSimpleCase() { - AbstractRequestMapping rm = new Boot1xRequestMapping("{[/superpath/mypath || mypath.json]}", null); - String[] splitPath = rm.getSplitPath(); - assertEquals(2, splitPath.length); - assertEquals("/superpath/mypath", splitPath[0]); - assertEquals("/mypath.json", splitPath[1]); - } - - @Test - public void testSplitPathMultipleCases() { - AbstractRequestMapping rm = new Boot1xRequestMapping("{[/superpath/mypath || mypath.json || somethingelse.what]}", null); - String[] splitPath = rm.getSplitPath(); - assertEquals(3, splitPath.length); - assertEquals("/superpath/mypath", splitPath[0]); - assertEquals("/mypath.json", splitPath[1]); - assertEquals("/somethingelse.what", splitPath[2]); - } - -} diff --git a/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/Boot2xRequestMappingsTest.java b/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/Boot2xRequestMappingsTest.java deleted file mode 100644 index 7725114d2..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/Boot2xRequestMappingsTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * 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 - * https://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.commons.boot.app.cli; - -import static org.junit.Assert.assertEquals; - -import java.util.Arrays; -import java.util.Collection; -import java.util.stream.Collectors; - -import org.apache.commons.io.IOUtils; -import org.json.JSONObject; -import org.junit.Test; -import org.springframework.ide.vscode.boot.java.livehover.v2.RequestMapping; -import org.springframework.ide.vscode.boot.java.livehover.v2.RequestMappingsParser20; - -import com.google.common.collect.ImmutableSet; - -public class Boot2xRequestMappingsTest { - - @Test - public void testWebRms() throws Exception { - String json = IOUtils.toString(Boot2xRequestMappingsTest.class.getResourceAsStream("/live-rm-beans/rms-boot2-web.json")); - Collection rms = RequestMappingsParser20.parse(new JSONObject(json)); - assertEquals(10, rms.size()); - - ImmutableSet expected = ImmutableSet.of( - "/error", - "/**/favicon.ico", - "/actuator", - "/actuator/health", - "/actuator/info", - "/hello", - "/qq", - "/pp", - "/webjars/**", - "/**" - ); - assertEquals(expected, - rms.stream() - .flatMap(rm -> Arrays.stream(rm.getSplitPath())) - .collect(Collectors.toSet()) - ); - - } - - @Test - public void testWebFluxAnnotationRms() throws Exception { - String json = IOUtils.toString(Boot2xRequestMappingsTest.class.getResourceAsStream("/live-rm-beans/rms-boot2-webflux.json")); - Collection rms = RequestMappingsParser20.parse(new JSONObject(json)); - - assertEquals(7, rms.size()); - - ImmutableSet expected = ImmutableSet.of( - "/actuator", - "/actuator/health", - "/actuator/info", - "/webjars/**", - "/hello", - "/pp", - "/qq", - "/**" - ); - assertEquals(expected, - rms.stream() - .flatMap(rm -> Arrays.stream(rm.getSplitPath())) - .collect(Collectors.toSet()) - ); - } - - @Test - public void testWebFluxAnnotationRmsFunctional() throws Exception { - String json = IOUtils.toString(Boot2xRequestMappingsTest.class.getResourceAsStream("/live-rm-beans/rms-boot2-webflux-functional.json")); - Collection rms = RequestMappingsParser20.parse(new JSONObject(json)); - - assertEquals(6, rms.size()); - - ImmutableSet expected = ImmutableSet.of( - "/actuator", - "/actuator/health", - "/actuator/info", - "/webjars/**", - "/hello", - "/**" - ); - assertEquals(expected, - rms.stream() - .flatMap(rm -> Arrays.stream(rm.getSplitPath())) - .collect(Collectors.toSet()) - ); - } - - @Test - public void testWebEurekaRms() throws Exception { - String json = IOUtils.toString(Boot2xRequestMappingsTest.class.getResourceAsStream("/live-rm-beans/rms-boot2-web-eureka.json")); - Collection rms = RequestMappingsParser20.parse(new JSONObject(json)); - assertEquals(9, rms.size()); - - ImmutableSet expected = ImmutableSet.of( - "/error", - "/**/favicon.ico", - "/actuator", - "/welcome", - "/actuator/health", - "/actuator/info", - "/webjars/**", - "/**" - ); - assertEquals(expected, - rms.stream() - .flatMap(rm -> Arrays.stream(rm.getSplitPath())) - .collect(Collectors.toSet()) - ); - - } - - @Test - public void testWebFluxEurekaRms() throws Exception { - String json = IOUtils.toString(Boot2xRequestMappingsTest.class.getResourceAsStream("/live-rm-beans/rms-boot2-webflux-eureka.json")); - Collection rms = RequestMappingsParser20.parse(new JSONObject(json)); - assertEquals(6, rms.size()); - - ImmutableSet expected = ImmutableSet.of( - "/actuator", - "/actuator/health", - "/actuator/info", - "/welcome", - "/webjars/**", - "/**" - ); - assertEquals(expected, - rms.stream() - .flatMap(rm -> Arrays.stream(rm.getSplitPath())) - .collect(Collectors.toSet()) - ); - - } -} diff --git a/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/LiveBeansModelTest.java b/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/LiveBeansModelTest.java deleted file mode 100644 index a6fd471b1..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/LiveBeansModelTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 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.vscode.commons.boot.app.cli; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - -import org.apache.commons.io.IOUtils; -import org.junit.Test; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBean; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBeansModel; - -/** - * @author Martin Lippert - */ -public class LiveBeansModelTest { - - @Test - public void testSimpleModel() throws Exception { - String json = IOUtils.toString(getResourceAsStream("/live-beans-models/simple-live-beans-model.json")); - LiveBeansModel model = LiveBeansModel.parse(json); - - LiveBean[] bean = model.getBeansOfType("org.test.DependencyA").toArray(new LiveBean[0]); - assertEquals(1, bean.length); - assertEquals("dependencyA", bean[0].getId()); - assertEquals("singleton", bean[0].getScope()); - assertEquals("org.test.DependencyA", bean[0].getType()); - assertEquals("file [/test-projects/classes/org/test/DependencyA.class]", bean[0].getResource()); - assertEquals(0, bean[0].getAliases().length); - assertEquals(0, bean[0].getDependencies().length); - - bean = model.getBeansOfName("dependencyB").toArray(new LiveBean[0]); - assertEquals(1, bean.length); - assertEquals("dependencyB", bean[0].getId()); - assertEquals("singleton", bean[0].getScope()); - assertEquals("org.test.DependencyB", bean[0].getType()); - assertEquals("file [/test-projects/classes/org/test/DependencyB.class]", bean[0].getResource()); - assertEquals(0, bean[0].getAliases().length); - assertEquals(0, bean[0].getDependencies().length); - } - - @Test - public void testEmptyModel() throws Exception { - String json = IOUtils.toString(getResourceAsStream("/live-beans-models/empty-live-beans-model.json")); - LiveBeansModel model = LiveBeansModel.parse(json); - - List bean = model.getBeansOfType("org.test.DependencyA"); - assertEquals(0, bean.size()); - } - - @Test - public void testTotallyEmptyModel() throws Exception { - String json = IOUtils.toString(getResourceAsStream("/live-beans-models/totally-empty-live-beans-model.json")); - LiveBeansModel model = LiveBeansModel.parse(json); - - List bean = model.getBeansOfType("org.test.DependencyA"); - assertEquals(0, bean.size()); - } - - @Test - public void custom_object_mapper_NON_DEFAULT_inclusion() throws IOException { - //See https://github.com/spring-projects/sts4/issues/80 - String json = IOUtils.toString(getResourceAsStream("/live-beans-models/custom_object_mapper_NON_DEFAULT_inclusion.json")); - LiveBeansModel model = LiveBeansModel.parse(json); - List beans = model.getBeansOfType("org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter"); - assertFalse(beans.isEmpty()); - assertEquals(2, beans.get(0).getDependencies().length); - } - - private InputStream getResourceAsStream(String string) { - return LiveBeansModelTest.class.getResourceAsStream(string); - } - -} diff --git a/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/LocalSpringBootAppTest.java b/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/LocalSpringBootAppTest.java deleted file mode 100644 index 83a688134..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/LocalSpringBootAppTest.java +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017 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.vscode.commons.boot.app.cli; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.net.URL; -import java.time.Duration; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.function.Predicate; -import java.util.stream.Collectors; - -import org.json.JSONObject; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Ignore; -import org.junit.Test; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBeansModel; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveConditional; -import org.springframework.ide.vscode.boot.java.livehover.v2.RequestMapping; -import org.springframework.ide.vscode.commons.util.AsyncProcess; -import org.springframework.ide.vscode.commons.util.ExceptionUtil; -import org.springframework.ide.vscode.commons.util.ExternalCommand; -import org.springframework.ide.vscode.commons.util.StringUtil; -import org.springframework.ide.vscode.commons.util.test.ACondition; - -import com.google.common.collect.ImmutableList; - -public class LocalSpringBootAppTest { - - private static final String[] appNames = { - "actuator-client-15-test-subject", // Boot 1.5 test app - "actuator-client-20-test-subject", //Boot 2.0 test app - "actuator-client-20-thin-test-subject", // Like the Boot 2.0 app, but packaged with thin launcher instead of fatjar - }; - - private static final Duration TIMEOUT = Duration.ofSeconds(60); // in CI build starting the app takes a while, starting several in parallel takes even longer - - private static final List TEST_PROFILES = ImmutableList.of("testing", "funny", "cameleon"); - - private static List testAppRunners; - - @BeforeClass - public static void setupClass() throws Exception { - testAppRunners = Arrays.asList(appNames).stream().map(appName -> { - try { - return startTestApplication(LocalSpringBootAppTest.class.getResource("/boot-apps/"+appName+"-0.0.1-SNAPSHOT.jar")); - } catch (Exception e) { - throw ExceptionUtil.unchecked(e); - } - }) - .collect(Collectors.toList()); - } - - @AfterClass - public static void tearDownClass() throws Exception { - for (AsyncProcess process : testAppRunners) { - process.kill(); - } - testAppRunners = null; - } - - private static AsyncProcess startTestApplication(URL jarUrl) throws Exception { - File jarFile = new File(jarUrl.toURI()); - return new AsyncProcess( - new File("."), - new ExternalCommand( - "java", - "-Dserver.port=0", //let spring boot pick randomized free port - "-jar", - jarFile.getAbsolutePath(), - "--spring.profiles.active="+StringUtil.collectionToCommaDelimitedString(TEST_PROFILES) - ), - false - ); - } - - private LocalSpringBootApp getAppContaining(String nameFragment) { - try { - Collection allApps = LocalSpringBootApp.getAllRunningJavaApps(); - try { - SpringBootApp result = allApps.stream().filter(localAppWithNameContaining(nameFragment)) - .findAny().get(); - return (LocalSpringBootApp) result; - } catch (NoSuchElementException e) { - //Improve error message for debugging... - StringBuilder foundAppNames = new StringBuilder(); - for (SpringBootApp app : allApps) { - foundAppNames.append("\n"); - foundAppNames.append(app.getProcessName()); - } - throw new NoSuchElementException("getAppContaining("+nameFragment+") in "+foundAppNames.toString()); - } - } catch (Exception e) { - throw ExceptionUtil.unchecked(e); - } - } - - private Predicate localAppWithNameContaining(String nameFragment) { - return app -> { - if (app instanceof LocalSpringBootApp) { - return ((LocalSpringBootApp)app).getProcessName().contains(nameFragment); - } - return false; - }; - } - - @Ignore @Test public void dumpJvmInfo() throws Exception { - //Ignored because this test may have timing issues. Still useful to - // run locally and inspect dump results, but may need some tweaking. - for (String appName : appNames) { - LocalSpringBootApp testApp = getAppContaining(appName); - testApp.dumpJvmInfo(); - System.out.println("======================================"); - } - } - - @Test public void getAllJavaApps() throws Exception { - Collection allApps = LocalSpringBootApp.getAllRunningJavaApps(); - for (String appName : appNames) { - Optional myProcess = allApps.stream().filter(localAppWithNameContaining(appName)).findAny(); - assertTrue(appName, myProcess.isPresent()); - } - } - - @Test public void getAllBootApps() throws Exception { - Collection allApps = LocalSpringBootApp.getAllRunningSpringApps(); - for (String appName : appNames) { - Optional myProcess = allApps.stream().filter(localAppWithNameContaining(appName)).findAny(); - assertTrue(myProcess.isPresent()); - } - } - - @Test - public void getPort() throws Exception { - for (LocalSpringBootApp testApp : getTestApps()) { - ACondition.waitFor(TIMEOUT, () -> { - int port = Integer.parseInt(testApp.getPort()); - assertTrue(port > 0); -// System.out.println("port = "+port); - }); - } - } - - private Collection getTestApps() throws Exception { - return ACondition.waitForValue(TIMEOUT, () -> Arrays.asList(appNames).stream() - .map(this::getAppContaining) - .collect(Collectors.toList()) - ); - } - - @Test - public void getHost() throws Exception { - for (LocalSpringBootApp testApp : getTestApps()) { - System.err.println("getHost for "+testApp); - ACondition.waitFor(TIMEOUT, () -> { - String host = testApp.getHost(); - assertTrue(StringUtil.hasText(host)); - System.out.println("host = "+host); - }); - } - } - - @Test - public void getEnvironment() throws Exception { - for (LocalSpringBootApp testApp : getTestApps()) { - ACondition.waitFor(TIMEOUT, () -> { - String env = testApp.getEnvironment(); - assertNonEmptyJsonObject(env); - }); - } - } - - @Test - public void getBeans() throws Exception { - for (LocalSpringBootApp testApp : getTestApps()) { - try { - ACondition.waitFor(TIMEOUT, () -> { - LiveBeansModel beansModel = testApp.getBeans(); - assertFalse(beansModel.isEmpty()); - // System.out.println("beans = "+beans); - }); - } catch (Throwable e) { - //Make it easier to identify the culprit of failing test - throw new RuntimeException("Failed for: "+testApp.getProcessName(), e); - } - } - } - - @Test - public void getRequestMappings() throws Exception { - for (LocalSpringBootApp testApp : getTestApps()) { - try { - ACondition.waitFor(TIMEOUT, () -> { - Collection result = testApp.getRequestMappings(); - assertTrue(result != null && result.size()>4); - // System.out.println("requestMappings = "+result); - }); - } catch (Exception e) { - throw new RuntimeException("Failed for: "+testApp, e); - } - } - } - - @Test - public void getLiveConditionals() throws Exception { - for (LocalSpringBootApp testApp : getTestApps()) { - try { - ACondition.waitFor(TIMEOUT, () -> { - Optional> result = testApp.getLiveConditionals(); - assertTrue(result.isPresent()); - assertFalse(result.get().isEmpty()); - }); - } catch (Exception e) { - throw new RuntimeException("Failed for: "+testApp, e); - } - } - } - - @Test - public void getProfiles() throws Exception { - for (LocalSpringBootApp testApp : getTestApps()) { - ACondition.waitFor(TIMEOUT, () -> { - List result = testApp.getActiveProfiles(); - assertEquals(ImmutableList.copyOf(TEST_PROFILES), result); - }); - } - } - - private void assertNonEmptyJsonObject(String jsonData) { - JSONObject parsed = new JSONObject(jsonData); - assertFalse(parsed.keySet().isEmpty()); - } - -} diff --git a/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/RemoteSpringBootAppTest.java b/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/RemoteSpringBootAppTest.java deleted file mode 100644 index a1841995b..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/java/org/springframework/ide/vscode/commons/boot/app/cli/RemoteSpringBootAppTest.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018, 2019 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.vscode.commons.boot.app.cli; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -public class RemoteSpringBootAppTest { - - @Test - public void canCreateInstance() throws Exception { - SpringBootApp instance = RemoteSpringBootApp.create("jmx:blah", "whatever.cfapps.io", "8888", "https", true); - assertNotNull(instance); - assertTrue(instance instanceof RemoteSpringBootApp); - } - -} diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/actuator-client-15-test-subject-0.0.1-SNAPSHOT.jar b/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/actuator-client-15-test-subject-0.0.1-SNAPSHOT.jar deleted file mode 100644 index 7c0edb30f..000000000 Binary files a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/actuator-client-15-test-subject-0.0.1-SNAPSHOT.jar and /dev/null differ diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/actuator-client-20-test-subject-0.0.1-SNAPSHOT.jar b/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/actuator-client-20-test-subject-0.0.1-SNAPSHOT.jar deleted file mode 100644 index 83bf28702..000000000 Binary files a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/actuator-client-20-test-subject-0.0.1-SNAPSHOT.jar and /dev/null differ diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/actuator-client-20-thin-test-subject-0.0.1-SNAPSHOT.jar b/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/actuator-client-20-thin-test-subject-0.0.1-SNAPSHOT.jar deleted file mode 100644 index addf9f5b6..000000000 Binary files a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/actuator-client-20-thin-test-subject-0.0.1-SNAPSHOT.jar and /dev/null differ diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/.gitignore b/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/.gitignore deleted file mode 100644 index 2af7cefb0..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/.gitignore +++ /dev/null @@ -1,24 +0,0 @@ -target/ -!.mvn/wrapper/maven-wrapper.jar - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -nbproject/private/ -build/ -nbbuild/ -dist/ -nbdist/ -.nb-gradle/ \ No newline at end of file diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/.mvn/wrapper/maven-wrapper.jar b/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 9cc84ea9b..000000000 Binary files a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/.mvn/wrapper/maven-wrapper.properties b/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/.mvn/wrapper/maven-wrapper.properties deleted file mode 100644 index 9dda3b659..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/.mvn/wrapper/maven-wrapper.properties +++ /dev/null @@ -1 +0,0 @@ -distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/mvnw b/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/mvnw deleted file mode 100644 index 2d1e3cfa2..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/mvnw.cmd b/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/mvnw.cmd deleted file mode 100644 index 86846aea5..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/pom.xml b/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/pom.xml deleted file mode 100644 index 499cb094e..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - 4.0.0 - - com.example - actuator-client-20-test-subject - 0.0.1-SNAPSHOT - jar - - actuator-client-20-test-subject - Demo project for Spring Boot - - - org.springframework.boot - spring-boot-starter-parent - 2.0.0.RC1 - - - - - UTF-8 - UTF-8 - 1.8 - - - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-starter-web - - - - org.springframework.boot - spring-boot-starter-test - test - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot - - true - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/src/main/java/com/example/ActuatorClient20TestSubjectApplication.java b/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/src/main/java/com/example/ActuatorClient20TestSubjectApplication.java deleted file mode 100644 index 3eb2137ea..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/src/main/java/com/example/ActuatorClient20TestSubjectApplication.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.example; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class ActuatorClient20TestSubjectApplication { - - public static void main(String[] args) { - SpringApplication.run(ActuatorClient20TestSubjectApplication.class, args); - } -} diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/src/main/resources/application.properties b/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/src/main/resources/application.properties deleted file mode 100644 index e69de29bb..000000000 diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/src/test/java/com/example/ActuatorClient20TestSubjectApplicationTests.java b/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/src/test/java/com/example/ActuatorClient20TestSubjectApplicationTests.java deleted file mode 100644 index b8c1b1d29..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/boot-apps/source-projects/actuator-client-20-test-subject/src/test/java/com/example/ActuatorClient20TestSubjectApplicationTests.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.example; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -@RunWith(SpringRunner.class) -@SpringBootTest -public class ActuatorClient20TestSubjectApplicationTests { - - @Test - public void contextLoads() { - } - -} diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-beans-models/custom_object_mapper_NON_DEFAULT_inclusion.json b/headless-services/commons/commons-boot-app-cli/src/test/resources/live-beans-models/custom_object_mapper_NON_DEFAULT_inclusion.json deleted file mode 100644 index bd5883032..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-beans-models/custom_object_mapper_NON_DEFAULT_inclusion.json +++ /dev/null @@ -1,1341 +0,0 @@ -{"contexts": {"application": {"beans": { - "endpointCachingOperationInvokerAdvisor": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/EndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvokerAdvisor", - "dependencies": ["environment"] - }, - "defaultServletHandlerMapping": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.HandlerMapping" - }, - "org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration$$EnhancerBySpringCGLIB$$9fb0ddb2", - "dependencies": ["spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties"] - }, - "metricsRestTemplateCustomizer": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/client/RestTemplateMetricsConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.metrics.web.client.MetricsRestTemplateCustomizer", - "dependencies": [ - "simpleMeterRegistry", - "restTemplateTagConfigurer" - ] - }, - "applicationTaskExecutor": { - "resource": "class path resource [org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor", - "dependencies": ["taskExecutorBuilder"] - }, - "characterEncodingFilter": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/HttpEncodingAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter" - }, - "management.endpoint.health-org.springframework.boot.actuate.autoconfigure.health.HealthEndpointProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.health.HealthEndpointProperties" - }, - "webEndpointDiscoverer": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.endpoint.web.annotation.WebEndpointDiscoverer", - "dependencies": [ - "endpointOperationParameterMapper", - "endpointMediaTypes", - "webEndpointPathMapper" - ] - }, - "org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfiguration$$EnhancerBySpringCGLIB$$18c7f8b6", - "dependencies": ["spring.servlet.multipart-org.springframework.boot.autoconfigure.web.servlet.MultipartProperties"] - }, - "org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration$$EnhancerBySpringCGLIB$$8889de77", - "dependencies": ["spring.mvc-org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties"] - }, - "preserveErrorControllerTargetClassPostProcessor": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$PreserveErrorControllerTargetClassPostProcessor" - }, - "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration$$EnhancerBySpringCGLIB$$e462fbb1", - "dependencies": ["org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79"] - }, - "logbackMetrics": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/LogbackMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.binder.logging.LogbackMetrics" - }, - "org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$67fb57f2", - "dependencies": [ - "org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79", - "management.endpoints.web-org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties" - ] - }, - "webEndpointPathMapper": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.web.MappingWebEndpointPathMapper" - }, - "management.info-org.springframework.boot.actuate.autoconfigure.info.InfoContributorProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.info.InfoContributorProperties" - }, - "org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$f2d9f453" - }, - "org.springframework.boot.actuate.autoconfigure.cache.CachesEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.cache.CachesEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$cfdbe376" - }, - "propertySourcesPlaceholderConfigurer": { - "resource": "class path resource [org/springframework/boot/autoconfigure/context/PropertyPlaceholderAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.context.support.PropertySourcesPlaceholderConfigurer" - }, - "faviconRequestHandler": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.resource.ResourceHttpRequestHandler" - }, - "org.springframework.boot.actuate.autoconfigure.endpoint.jmx.JmxEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.jmx.JmxEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$874ca7f0", - "dependencies": [ - "org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79", - "management.endpoints.jmx-org.springframework.boot.actuate.autoconfigure.endpoint.jmx.JmxEndpointProperties" - ] - }, - "jmxMBeanExporter": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/jmx/JmxEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.endpoint.jmx.JmxEndpointExporter", - "dependencies": [ - "mbeanServer", - "environment", - "jmxAnnotationEndpointDiscoverer" - ] - }, - "beanNameViewResolver": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.view.BeanNameViewResolver" - }, - "loggingCodecCustomizer": { - "resource": "class path resource [org/springframework/boot/autoconfigure/http/codec/CodecsAutoConfiguration$LoggingCodecConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$LoggingCodecConfiguration$$Lambda$492/1343835789", - "dependencies": ["spring.http-org.springframework.boot.autoconfigure.http.HttpProperties"] - }, - "org.springframework.boot.actuate.autoconfigure.endpoint.web.servlet.WebMvcEndpointManagementContextConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.web.servlet.WebMvcEndpointManagementContextConfiguration$$EnhancerBySpringCGLIB$$a754c062" - }, - "viewResolver": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.view.ContentNegotiatingViewResolver", - "dependencies": ["org.springframework.beans.factory.support.DefaultListableBeanFactory@6ed3ccb2"] - }, - "management.endpoints.web.cors-org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties" - }, - "objectMapper": { - "resource": "com.example.demo.DemoApplication", - "scope": "singleton", - "type": "com.fasterxml.jackson.databind.ObjectMapper" - }, - "methodValidationPostProcessor": { - "resource": "class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.validation.beanvalidation.MethodValidationPostProcessor", - "dependencies": ["environment"] - }, - "stringHttpMessageConverter": { - "resource": "class path resource [org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.http.converter.StringHttpMessageConverter" - }, - "org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration$TomcatWebServerFactoryCustomizerConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration$TomcatWebServerFactoryCustomizerConfiguration$$EnhancerBySpringCGLIB$$dcae46d5" - }, - "tomcatServletWebServerFactoryCustomizer": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.TomcatServletWebServerFactoryCustomizer", - "dependencies": ["server-org.springframework.boot.autoconfigure.web.ServerProperties"] - }, - "org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration$$EnhancerBySpringCGLIB$$692f5ad5", - "dependencies": ["environment"] - }, - "server-org.springframework.boot.autoconfigure.web.ServerProperties": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.ServerProperties" - }, - "messageConverters": { - "resource": "class path resource [org/springframework/boot/autoconfigure/http/HttpMessageConvertersAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.http.HttpMessageConverters" - }, - "jsonComponentModule": { - "resource": "class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.jackson.JsonComponentModule" - }, - "websocketServletWebServerCustomizer": { - "resource": "class path resource [org/springframework/boot/autoconfigure/websocket/servlet/WebSocketServletAutoConfiguration$TomcatWebSocketConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.websocket.servlet.TomcatWebSocketServletWebServerCustomizer" - }, - "jmxAnnotationEndpointDiscoverer": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/jmx/JmxEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.endpoint.jmx.annotation.JmxEndpointDiscoverer", - "dependencies": ["endpointOperationParameterMapper"] - }, - "org.springframework.boot.actuate.autoconfigure.web.mappings.MappingsEndpointAutoConfiguration$ServletWebConfiguration$SpringMvcConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.web.mappings.MappingsEndpointAutoConfiguration$ServletWebConfiguration$SpringMvcConfiguration$$EnhancerBySpringCGLIB$$4a69038d" - }, - "org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration$$EnhancerBySpringCGLIB$$ebeab9e9" - }, - "mappingJackson2HttpMessageConverter": { - "resource": "class path resource [org/springframework/boot/autoconfigure/http/JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.http.converter.json.MappingJackson2HttpMessageConverter", - "dependencies": ["objectMapper"] - }, - "org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$e2c10cb7", - "dependencies": ["management.endpoint.env-org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointProperties"] - }, - "healthAggregator": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.health.OrderedHealthAggregator" - }, - "org.springframework.boot.actuate.autoconfigure.context.ShutdownEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.context.ShutdownEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$2182525e" - }, - "meterRegistryPostProcessor": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryPostProcessor", - "dependencies": ["org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79"] - }, - "contextCapturingServletTomcatCustomizer": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.web.tomcat.TomcatMetricsAutoConfiguration$$Lambda$207/1187779195" - }, - "mbeanExporter": { - "resource": "class path resource [org/springframework/boot/autoconfigure/jmx/JmxAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.jmx.export.annotation.AnnotationMBeanExporter", - "dependencies": ["objectNamingStrategy"] - }, - "org.springframework.boot.actuate.autoconfigure.system.DiskSpaceHealthIndicatorAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.system.DiskSpaceHealthIndicatorAutoConfiguration$$EnhancerBySpringCGLIB$$373f4c75" - }, - "endpointMediaTypes": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes" - }, - "org.springframework.boot.actuate.autoconfigure.health.HealthEndpointWebExtensionConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.health.HealthEndpointWebExtensionConfiguration$$EnhancerBySpringCGLIB$$3f1403ff" - }, - "org.springframework.boot.actuate.autoconfigure.metrics.SystemMetricsAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.SystemMetricsAutoConfiguration$$EnhancerBySpringCGLIB$$a8c4d215" - }, - "management.server-org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties" - }, - "mbeanServer": { - "resource": "class path resource [org/springframework/boot/autoconfigure/jmx/JmxAutoConfiguration.class]", - "scope": "singleton", - "type": "com.sun.jmx.mbeanserver.JmxMBeanServer" - }, - "servletWebServerFactoryCustomizer": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryCustomizer", - "dependencies": ["server-org.springframework.boot.autoconfigure.web.ServerProperties"] - }, - "mvcUrlPathHelper": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.util.UrlPathHelper" - }, - "org.springframework.boot.actuate.autoconfigure.metrics.web.servlet.WebMvcMetricsAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.web.servlet.WebMvcMetricsAutoConfiguration$$EnhancerBySpringCGLIB$$ea2473af", - "dependencies": ["management.metrics-org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties"] - }, - "servletMappingDescriptionProvider": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/web/mappings/MappingsEndpointAutoConfiguration$ServletWebConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.web.mappings.servlet.ServletsMappingDescriptionProvider" - }, - "webServerFactoryCustomizerBeanPostProcessor": { - "scope": "singleton", - "type": "org.springframework.boot.web.server.WebServerFactoryCustomizerBeanPostProcessor" - }, - "metricsHttpClientUriTagFilter": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/client/HttpClientMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.config.MeterFilter$9" - }, - "org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration$$EnhancerBySpringCGLIB$$9771a3d9" - }, - "controllerEndpointHandlerMapping": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.endpoint.web.servlet.ControllerEndpointHandlerMapping", - "dependencies": [ - "controllerEndpointDiscoverer", - "management.endpoints.web.cors-org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties", - "management.endpoints.web-org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties" - ] - }, - "management.endpoint.env-org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointProperties" - }, - "org.springframework.boot.actuate.autoconfigure.metrics.JvmMetricsAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.JvmMetricsAutoConfiguration$$EnhancerBySpringCGLIB$$28cfd89b" - }, - "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration$$EnhancerBySpringCGLIB$$9f79e1a0" - }, - "org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration$$EnhancerBySpringCGLIB$$23c44c3b", - "dependencies": ["spring.http-org.springframework.boot.autoconfigure.http.HttpProperties"] - }, - "healthIndicatorRegistry": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthIndicatorAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.health.DefaultHealthIndicatorRegistry", - "dependencies": ["org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79"] - }, - "org.springframework.boot.actuate.autoconfigure.management.ThreadDumpEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.management.ThreadDumpEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$7e51d920" - }, - "standardJacksonObjectMapperBuilderCustomizer": { - "resource": "class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfiguration$StandardJackson2ObjectMapperBuilderCustomizer", - "dependencies": [ - "org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79", - "spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties" - ] - }, - "taskSchedulerBuilder": { - "resource": "class path resource [org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.task.TaskSchedulerBuilder", - "dependencies": ["spring.task.scheduling-org.springframework.boot.autoconfigure.task.TaskSchedulingProperties"] - }, - "metricsEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/MetricsEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.metrics.MetricsEndpoint", - "dependencies": ["simpleMeterRegistry"] - }, - "org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration$$EnhancerBySpringCGLIB$$622252dd", - "dependencies": ["spring.task.execution-org.springframework.boot.autoconfigure.task.TaskExecutionProperties"] - }, - "org.springframework.boot.actuate.autoconfigure.info.InfoContributorAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.info.InfoContributorAutoConfiguration$$EnhancerBySpringCGLIB$$fce80c7b", - "dependencies": ["management.info-org.springframework.boot.actuate.autoconfigure.info.InfoContributorProperties"] - }, - "org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$$EnhancerBySpringCGLIB$$c4e50ec4" - }, - "simpleMeterRegistry": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.simple.SimpleMeterRegistry", - "dependencies": [ - "simpleConfig", - "micrometerClock" - ] - }, - "org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration$$EnhancerBySpringCGLIB$$c63be16a" - }, - "environmentEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.env.EnvironmentEndpoint", - "dependencies": ["environment"] - }, - "jacksonCodecCustomizer": { - "resource": "class path resource [org/springframework/boot/autoconfigure/http/codec/CodecsAutoConfiguration$JacksonCodecConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$JacksonCodecConfiguration$$Lambda$493/688581408", - "dependencies": ["objectMapper"] - }, - "conventionErrorViewResolver": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.error.DefaultErrorViewResolver" - }, - "org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration$$EnhancerBySpringCGLIB$$41700a87", - "dependencies": [ - "org.springframework.beans.factory.support.DefaultListableBeanFactory@6ed3ccb2", - "org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter" - ] - }, - "org.springframework.boot.actuate.autoconfigure.metrics.web.tomcat.TomcatMetricsAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.web.tomcat.TomcatMetricsAutoConfiguration$$EnhancerBySpringCGLIB$$93f9792e" - }, - "org.springframework.boot.actuate.autoconfigure.metrics.LogbackMetricsAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.LogbackMetricsAutoConfiguration$$EnhancerBySpringCGLIB$$a155fe65" - }, - "spring.mvc-org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties" - }, - "localeCharsetMappingsCustomizer": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/HttpEncodingAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration$LocaleCharsetMappingsCustomizer" - }, - "org.springframework.boot.actuate.autoconfigure.logging.LoggersEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.logging.LoggersEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$80afb1f5" - }, - "configurationPropertiesReportEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/context/properties/ConfigurationPropertiesReportEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.context.properties.ConfigurationPropertiesReportEndpoint" - }, - "formContentFilter": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.web.servlet.filter.OrderedFormContentFilter" - }, - "multipartConfigElement": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfiguration.class]", - "scope": "singleton", - "type": "javax.servlet.MultipartConfigElement" - }, - "requestContextFilter": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]", - "scope": "singleton", - "type": "org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter" - }, - "defaultViewResolver": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.view.InternalResourceViewResolver" - }, - "org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceAutoConfiguration$$EnhancerBySpringCGLIB$$433b1c08" - }, - "jacksonObjectMapperBuilder": { - "resource": "class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.http.converter.json.Jackson2ObjectMapperBuilder", - "dependencies": ["standardJacksonObjectMapperBuilderCustomizer"] - }, - "org.springframework.boot.actuate.autoconfigure.web.mappings.MappingsEndpointAutoConfiguration$ServletWebConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.web.mappings.MappingsEndpointAutoConfiguration$ServletWebConfiguration$$EnhancerBySpringCGLIB$$dc6d7f18" - }, - "beansEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/beans/BeansEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.beans.BeansEndpoint", - "dependencies": ["org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79"] - }, - "management.endpoints.jmx-org.springframework.boot.actuate.autoconfigure.endpoint.jmx.JmxEndpointProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.jmx.JmxEndpointProperties", - "dependencies": ["environment"] - }, - "spring.task.scheduling-org.springframework.boot.autoconfigure.task.TaskSchedulingProperties": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.task.TaskSchedulingProperties" - }, - "webMvcMetricsFilter": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.web.servlet.FilterRegistrationBean", - "dependencies": [ - "simpleMeterRegistry", - "webMvcTagsProvider", - "org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79" - ] - }, - "traceRepository": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/trace/http/HttpTraceAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository" - }, - "org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$LoggingCodecConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$LoggingCodecConfiguration$$EnhancerBySpringCGLIB$$7358a5df" - }, - "healthEndpointWebExtension": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointWebExtensionConfiguration$ServletWebHealthConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.health.HealthEndpointWebExtension", - "dependencies": [ - "healthEndpoint", - "healthWebEndpointResponseMapper" - ] - }, - "restTemplateBuilder": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/client/RestTemplateAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.web.client.RestTemplateBuilder" - }, - "multipartResolver": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/MultipartAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.multipart.support.StandardServletMultipartResolver" - }, - "org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration$WebEndpointServletConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration$WebEndpointServletConfiguration$$EnhancerBySpringCGLIB$$e4a44148" - }, - "requestMappingHandlerMapping": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping", - "dependencies": [ - "mvcConversionService", - "mvcResourceUrlProvider", - "mvcContentNegotiationManager" - ] - }, - "webExposeExcludePropertyEndpointFilter": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.ExposeExcludePropertyEndpointFilter" - }, - "org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration$SameManagementContextConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration$SameManagementContextConfiguration$$EnhancerBySpringCGLIB$$b0f88f3f", - "dependencies": ["environment"] - }, - "requestMappingHandlerAdapter": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter", - "dependencies": [ - "mvcContentNegotiationManager", - "mvcConversionService", - "mvcValidator" - ] - }, - "restTemplateTagConfigurer": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/client/RestTemplateMetricsConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.metrics.web.client.DefaultRestTemplateExchangeTagsProvider" - }, - "org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration$$EnhancerBySpringCGLIB$$a9d770a9", - "dependencies": ["spring.http-org.springframework.boot.autoconfigure.http.HttpProperties"] - }, - "org.springframework.boot.actuate.autoconfigure.endpoint.web.ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.web.ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration$$EnhancerBySpringCGLIB$$8cb711e2", - "dependencies": ["org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79"] - }, - "org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration$$EnhancerBySpringCGLIB$$47824a91" - }, - "org.springframework.boot.actuate.autoconfigure.logging.LogFileWebEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.logging.LogFileWebEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$d06f4290", - "dependencies": ["management.endpoint.logfile-org.springframework.boot.actuate.autoconfigure.logging.LogFileWebEndpointProperties"] - }, - "springApplicationAdminRegistrar": { - "resource": "class path resource [org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.admin.SpringApplicationAdminMXBeanRegistrar" - }, - "org.springframework.boot.autoconfigure.condition.BeanTypeRegistry": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.condition.BeanTypeRegistry" - }, - "spring.info-org.springframework.boot.autoconfigure.info.ProjectInfoProperties": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.info.ProjectInfoProperties" - }, - "healthWebEndpointResponseMapper": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointWebExtensionConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.health.HealthWebEndpointResponseMapper", - "dependencies": [ - "createHealthStatusHttpMapper", - "management.endpoint.health-org.springframework.boot.actuate.autoconfigure.health.HealthEndpointProperties" - ] - }, - "org.springframework.boot.actuate.autoconfigure.metrics.MetricsEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.MetricsEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$d2f02cb1" - }, - "endpointOperationParameterMapper": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/EndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.endpoint.invoke.convert.ConversionServiceParameterValueMapper" - }, - "infoEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/info/InfoEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.info.InfoEndpoint" - }, - "org.springframework.boot.actuate.autoconfigure.metrics.web.client.HttpClientMetricsAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.web.client.HttpClientMetricsAutoConfiguration$$EnhancerBySpringCGLIB$$1759a976", - "dependencies": ["management.metrics-org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties"] - }, - "spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.ResourceProperties" - }, - "management.health.status-org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorProperties" - }, - "org.springframework.boot.actuate.autoconfigure.info.InfoEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.info.InfoEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$24beed5b" - }, - "classLoaderMetrics": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/JvmMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics" - }, - "servletWebChildContextFactory": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/web/servlet/ServletManagementContextAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextFactory" - }, - "org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration$$EnhancerBySpringCGLIB$$c60c4555" - }, - "org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory": { - "scope": "singleton", - "type": "org.springframework.core.type.classreading.CachingMetadataReaderFactory" - }, - "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$ParameterNamesModuleConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$ParameterNamesModuleConfiguration$$EnhancerBySpringCGLIB$$c64558ce" - }, - "mvcContentNegotiationManager": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.accept.ContentNegotiationManager" - }, - "objectNamingStrategy": { - "resource": "class path resource [org/springframework/boot/autoconfigure/jmx/JmxAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.jmx.ParentAwareNamingStrategy" - }, - "org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration$$EnhancerBySpringCGLIB$$8d300dde" - }, - "httpExchangeTracer": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/trace/http/HttpTraceAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.trace.http.HttpExchangeTracer", - "dependencies": ["management.trace.http-org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceProperties"] - }, - "org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration$$EnhancerBySpringCGLIB$$8a42361d" - }, - "org.springframework.boot.actuate.autoconfigure.audit.AuditEventsEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.audit.AuditEventsEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$ff407548" - }, - "errorAttributes": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.web.servlet.error.DefaultErrorAttributes" - }, - "httpRequestHandlerAdapter": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter" - }, - "org.springframework.boot.actuate.autoconfigure.web.mappings.MappingsEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.web.mappings.MappingsEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$d3626f15" - }, - "beanNameHandlerMapping": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping" - }, - "org.springframework.boot.actuate.autoconfigure.health.HealthEndpointConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.health.HealthEndpointConfiguration$$EnhancerBySpringCGLIB$$f3236fea" - }, - "webMvcTagsProvider": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.metrics.web.servlet.DefaultWebMvcTagsProvider" - }, - "createHealthStatusHttpMapper": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointWebExtensionConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.health.HealthStatusHttpMapper", - "dependencies": ["management.health.status-org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorProperties"] - }, - "spring.servlet.multipart-org.springframework.boot.autoconfigure.web.servlet.MultipartProperties": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.MultipartProperties" - }, - "org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration$$EnhancerBySpringCGLIB$$127cc720", - "dependencies": ["spring.info-org.springframework.boot.autoconfigure.info.ProjectInfoProperties"] - }, - "diskSpaceHealthIndicatorProperties": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.system.DiskSpaceHealthIndicatorProperties" - }, - "org.springframework.boot.actuate.autoconfigure.metrics.web.client.RestTemplateMetricsConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.web.client.RestTemplateMetricsConfiguration$$EnhancerBySpringCGLIB$$8c427960", - "dependencies": ["management.metrics-org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties"] - }, - "org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryConfiguration$EmbeddedTomcat": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryConfiguration$EmbeddedTomcat$$EnhancerBySpringCGLIB$$41052bf1" - }, - "management.trace.http-org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceProperties" - }, - "org.springframework.boot.actuate.autoconfigure.management.HeapDumpWebEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.management.HeapDumpWebEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$566ca8a" - }, - "resourceHandlerMapping": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.handler.SimpleUrlHandlerMapping", - "dependencies": [ - "mvcContentNegotiationManager", - "mvcUrlPathHelper", - "mvcPathMatcher" - ] - }, - "simpleControllerHandlerAdapter": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" - }, - "org.springframework.boot.actuate.autoconfigure.health.HealthEndpointWebExtensionConfiguration$ServletWebHealthConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.health.HealthEndpointWebExtensionConfiguration$ServletWebHealthConfiguration$$EnhancerBySpringCGLIB$$308e9d86" - }, - "httpTraceEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/trace/http/HttpTraceEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.trace.http.HttpTraceEndpoint", - "dependencies": ["traceRepository"] - }, - "spring.http-org.springframework.boot.autoconfigure.http.HttpProperties": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.http.HttpProperties" - }, - "org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration$$EnhancerBySpringCGLIB$$6b1ae9a6" - }, - "cachesEndpointWebExtension": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.cache.CachesEndpointWebExtension", - "dependencies": ["cachesEndpoint"] - }, - "org.springframework.boot.actuate.autoconfigure.context.properties.ConfigurationPropertiesReportEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.context.properties.ConfigurationPropertiesReportEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$33057312", - "dependencies": ["management.endpoint.configprops-org.springframework.boot.actuate.autoconfigure.context.properties.ConfigurationPropertiesReportEndpointProperties"] - }, - "management.metrics-org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties" - }, - "org.springframework.boot.actuate.autoconfigure.audit.AuditAutoConfiguration$AuditEventRepositoryConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.audit.AuditAutoConfiguration$AuditEventRepositoryConfiguration$$EnhancerBySpringCGLIB$$7020f39f" - }, - "management.endpoint.configprops-org.springframework.boot.actuate.autoconfigure.context.properties.ConfigurationPropertiesReportEndpointProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.context.properties.ConfigurationPropertiesReportEndpointProperties" - }, - "parameterNamesModule": { - "resource": "class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$ParameterNamesModuleConfiguration.class]", - "scope": "singleton", - "type": "com.fasterxml.jackson.module.paramnames.ParameterNamesModule" - }, - "micrometerClock": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.Clock$1" - }, - "org.springframework.boot.actuate.autoconfigure.beans.BeansEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.beans.BeansEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$637bccf1" - }, - "propertiesMeterFilter": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.PropertiesMeterFilter", - "dependencies": ["management.metrics-org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties"] - }, - "auditEventRepository": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfiguration$AuditEventRepositoryConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.audit.InMemoryAuditEventRepository" - }, - "org.springframework.boot.actuate.autoconfigure.audit.AuditAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.audit.AuditAutoConfiguration$$EnhancerBySpringCGLIB$$7837c276" - }, - "org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration$$EnhancerBySpringCGLIB$$7198b388" - }, - "uptimeMetrics": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.binder.system.UptimeMetrics" - }, - "controllerExposeExcludePropertyEndpointFilter": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.ExposeExcludePropertyEndpointFilter" - }, - "pathMappedEndpoints": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.endpoint.web.PathMappedEndpoints", - "dependencies": [ - "jmxAnnotationEndpointDiscoverer", - "servletEndpointDiscoverer", - "webEndpointDiscoverer", - "controllerEndpointDiscoverer", - "management.endpoints.web-org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties" - ] - }, - "jvmThreadMetrics": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/JvmMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics" - }, - "scheduledTasksEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/scheduling/ScheduledTasksEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.scheduling.ScheduledTasksEndpoint" - }, - "hiddenHttpMethodFilter": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.web.servlet.filter.OrderedHiddenHttpMethodFilter" - }, - "heapDumpWebEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/management/HeapDumpWebEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.management.HeapDumpWebEndpoint" - }, - "org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceAutoConfiguration$ServletTraceFilterConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.trace.http.HttpTraceAutoConfiguration$ServletTraceFilterConfiguration$$EnhancerBySpringCGLIB$$9034eec2" - }, - "managementServletContext": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/web/servlet/ServletManagementContextAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration$$Lambda$452/1859965144", - "dependencies": ["management.endpoints.web-org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties"] - }, - "fileDescriptorMetrics": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.binder.system.FileDescriptorMetrics" - }, - "org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$$EnhancerBySpringCGLIB$$22ebf8c", - "dependencies": [ - "server-org.springframework.boot.autoconfigure.web.ServerProperties", - "dispatcherServletRegistration" - ] - }, - "servletEndpointDiscoverer": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration$WebEndpointServletConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointDiscoverer", - "dependencies": [ - "org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79", - "webEndpointPathMapper" - ] - }, - "environmentEndpointWebExtension": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.env.EnvironmentEndpointWebExtension", - "dependencies": ["environmentEndpoint"] - }, - "metricsHttpServerUriTagFilter": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.config.MeterFilter$9" - }, - "mvcValidator": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.validation.ValidatorAdapter" - }, - "org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration$TomcatWebSocketConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration$TomcatWebSocketConfiguration$$EnhancerBySpringCGLIB$$4f1ccef6" - }, - "conditionsReportEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/condition/ConditionsReportEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.condition.ConditionsReportEndpoint", - "dependencies": ["org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79"] - }, - "org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration$$EnhancerBySpringCGLIB$$f0b6859b" - }, - "mvcResourceUrlProvider": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.resource.ResourceUrlProvider" - }, - "healthEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.health.HealthEndpoint", - "dependencies": [ - "healthAggregator", - "healthIndicatorRegistry" - ] - }, - "org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration$SameManagementContextConfiguration$EnableSameManagementContextConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration$SameManagementContextConfiguration$EnableSameManagementContextConfiguration$$EnhancerBySpringCGLIB$$3d75c70" - }, - "spring.task.execution-org.springframework.boot.autoconfigure.task.TaskExecutionProperties": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.task.TaskExecutionProperties" - }, - "viewControllerHandlerMapping": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.HandlerMapping" - }, - "org.springframework.boot.actuate.autoconfigure.mongo.MongoHealthIndicatorAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.mongo.MongoHealthIndicatorAutoConfiguration$$EnhancerBySpringCGLIB$$5a863a4f" - }, - "servletEndpointRegistrar": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar", - "dependencies": [ - "management.endpoints.web-org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties", - "servletEndpointDiscoverer" - ] - }, - "dumpEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/management/ThreadDumpEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.management.ThreadDumpEndpoint" - }, - "dispatcherServlet": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration$DispatcherServletConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.DispatcherServlet" - }, - "org.springframework.boot.actuate.autoconfigure.endpoint.web.ServletEndpointManagementContextConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.web.ServletEndpointManagementContextConfiguration$$EnhancerBySpringCGLIB$$a8fce9a8" - }, - "org.springframework.boot.actuate.autoconfigure.redis.RedisHealthIndicatorAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.redis.RedisHealthIndicatorAutoConfiguration$$EnhancerBySpringCGLIB$$a89b6ddd" - }, - "org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$$EnhancerBySpringCGLIB$$ac4f87e" - }, - "demoApplication": { - "scope": "singleton", - "type": "com.example.demo.DemoApplication$$EnhancerBySpringCGLIB$$ae2c315f" - }, - "webEndpointServletHandlerMapping": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/servlet/WebMvcEndpointManagementContextConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping", - "dependencies": [ - "webEndpointDiscoverer", - "servletEndpointDiscoverer", - "controllerEndpointDiscoverer", - "endpointMediaTypes", - "management.endpoints.web.cors-org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties", - "management.endpoints.web-org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties" - ] - }, - "processorMetrics": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.binder.system.ProcessorMetrics" - }, - "dispatcherServletMappingDescriptionProvider": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/web/mappings/MappingsEndpointAutoConfiguration$ServletWebConfiguration$SpringMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.web.mappings.servlet.DispatcherServletsMappingDescriptionProvider" - }, - "org.springframework.boot.actuate.autoconfigure.scheduling.ScheduledTasksEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.scheduling.ScheduledTasksEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$666cb2ce" - }, - "org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorAutoConfiguration$$EnhancerBySpringCGLIB$$e004d5c7", - "dependencies": ["management.health.status-org.springframework.boot.actuate.autoconfigure.health.HealthIndicatorProperties"] - }, - "org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration$$EnhancerBySpringCGLIB$$d7392c40" - }, - "tomcatMetrics": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.binder.tomcat.TomcatMetrics" - }, - "auditEventsEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/audit/AuditEventsEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.audit.AuditEventsEndpoint", - "dependencies": ["auditEventRepository"] - }, - "org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$$EnhancerBySpringCGLIB$$e373d56c", - "dependencies": [ - "spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties", - "spring.mvc-org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties", - "org.springframework.beans.factory.support.DefaultListableBeanFactory@6ed3ccb2" - ] - }, - "org.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticsearchHealthIndicatorAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticsearchHealthIndicatorAutoConfiguration$$EnhancerBySpringCGLIB$$74504661" - }, - "errorPageRegistrarBeanPostProcessor": { - "scope": "singleton", - "type": "org.springframework.boot.web.server.ErrorPageRegistrarBeanPostProcessor" - }, - "errorPageCustomizer": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$ErrorPageCustomizer" - }, - "mvcConversionService": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.format.WebConversionService" - }, - "loggersEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/logging/LoggersEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.logging.LoggersEndpoint", - "dependencies": ["springBootLoggingSystem"] - }, - "org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfiguration$$EnhancerBySpringCGLIB$$16c3942c", - "dependencies": [ - "org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79", - "spring.resources-org.springframework.boot.autoconfigure.web.ResourceProperties" - ] - }, - "jmxIncludeExcludePropertyEndpointFilter": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/jmx/JmxEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.ExposeExcludePropertyEndpointFilter" - }, - "controllerEndpointDiscoverer": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/WebEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointDiscoverer", - "dependencies": ["webEndpointPathMapper"] - }, - "diskSpaceHealthIndicator": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/system/DiskSpaceHealthIndicatorAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.system.DiskSpaceHealthIndicator", - "dependencies": ["diskSpaceHealthIndicatorProperties"] - }, - "tomcatWebServerFactoryCustomizer": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/embedded/EmbeddedWebServerFactoryCustomizerAutoConfiguration$TomcatWebServerFactoryCustomizerConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.embedded.TomcatWebServerFactoryCustomizer", - "dependencies": [ - "environment", - "server-org.springframework.boot.autoconfigure.web.ServerProperties" - ] - }, - "faviconHandlerMapping": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.handler.SimpleUrlHandlerMapping", - "dependencies": ["faviconRequestHandler"] - }, - "jvmMemoryMetrics": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/JvmMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics" - }, - "org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration$$EnhancerBySpringCGLIB$$906f3e30" - }, - "org.springframework.boot.actuate.autoconfigure.condition.ConditionsReportEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.condition.ConditionsReportEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$e93fb554" - }, - "org.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfiguration$$EnhancerBySpringCGLIB$$540d7bc9" - }, - "mvcPathMatcher": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.util.AntPathMatcher" - }, - "handlerExceptionResolver": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.handler.HandlerExceptionResolverComposite", - "dependencies": ["mvcContentNegotiationManager"] - }, - "management.metrics.export.simple-org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleProperties" - }, - "org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration$$EnhancerBySpringCGLIB$$22069266" - }, - "basicErrorController": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController", - "dependencies": ["errorAttributes"] - }, - "cachesEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/cache/CachesEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.cache.CachesEndpoint" - }, - "org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$$EnhancerBySpringCGLIB$$492a4d04" - }, - "dispatcherServletRegistration": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.DispatcherServletRegistrationBean", - "dependencies": ["dispatcherServlet"] - }, - "mappingsEndpoint": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/web/mappings/MappingsEndpointAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.web.mappings.MappingsEndpoint", - "dependencies": ["org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79"] - }, - "org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$JacksonCodecConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration$JacksonCodecConfiguration$$EnhancerBySpringCGLIB$$3e5cd553" - }, - "management.endpoints.web-org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties" - }, - "tomcatServletWebServerFactory": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/ServletWebServerFactoryConfiguration$EmbeddedTomcat.class]", - "scope": "singleton", - "type": "org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory" - }, - "org.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration$$EnhancerBySpringCGLIB$$5d9a483b" - }, - "spring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonProperties": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.jackson.JacksonProperties" - }, - "auditListener": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/audit/AuditAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.audit.listener.AuditListener" - }, - "httpTraceFilter": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/trace/http/HttpTraceAutoConfiguration$ServletTraceFilterConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter", - "dependencies": [ - "traceRepository", - "httpExchangeTracer" - ] - }, - "error": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/error/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$SpelView" - }, - "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$$EnhancerBySpringCGLIB$$1421d727" - }, - "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration$$EnhancerBySpringCGLIB$$32163998" - }, - "org.springframework.boot.actuate.autoconfigure.health.HealthEndpointAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.health.HealthEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$9804379b" - }, - "org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration$$EnhancerBySpringCGLIB$$e162a604" - }, - "org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletConfiguration$$EnhancerBySpringCGLIB$$268249d0", - "dependencies": [ - "spring.http-org.springframework.boot.autoconfigure.http.HttpProperties", - "spring.mvc-org.springframework.boot.autoconfigure.web.servlet.WebMvcProperties" - ] - }, - "org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration$$EnhancerBySpringCGLIB$$55ee2923" - }, - "jvmGcMetrics": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/JvmMetricsAutoConfiguration.class]", - "scope": "singleton", - "type": "io.micrometer.core.instrument.binder.jvm.JvmGcMetrics" - }, - "mvcViewResolver": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.servlet.view.ViewResolverComposite", - "dependencies": ["mvcContentNegotiationManager"] - }, - "simpleConfig": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimplePropertiesConfigAdapter", - "dependencies": ["management.metrics.export.simple-org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleProperties"] - }, - "welcomePageHandlerMapping": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]", - "scope": "singleton", - "type": "org.springframework.boot.autoconfigure.web.servlet.WelcomePageHandlerMapping", - "dependencies": ["org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6b19b79"] - }, - "servletExposeExcludePropertyEndpointFilter": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.endpoint.ExposeExcludePropertyEndpointFilter", - "dependencies": ["management.endpoints.web-org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties"] - }, - "org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.web.servlet.ServletManagementContextAutoConfiguration$$EnhancerBySpringCGLIB$$ce9a483e" - }, - "mvcUriComponentsContributor": { - "resource": "class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.web.method.support.CompositeUriComponentsContributor", - "dependencies": [ - "requestMappingHandlerAdapter", - "mvcConversionService" - ] - }, - "filterMappingDescriptionProvider": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/web/mappings/MappingsEndpointAutoConfiguration$ServletWebConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.web.mappings.servlet.FiltersMappingDescriptionProvider" - }, - "org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.web.server.ManagementContextAutoConfiguration$$EnhancerBySpringCGLIB$$7712702d" - }, - "envInfoContributor": { - "resource": "class path resource [org/springframework/boot/actuate/autoconfigure/info/InfoContributorAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.actuate.info.EnvironmentInfoContributor", - "dependencies": ["environment"] - }, - "management.endpoint.logfile-org.springframework.boot.actuate.autoconfigure.logging.LogFileWebEndpointProperties": { - "scope": "singleton", - "type": "org.springframework.boot.actuate.autoconfigure.logging.LogFileWebEndpointProperties" - }, - "taskExecutorBuilder": { - "resource": "class path resource [org/springframework/boot/autoconfigure/task/TaskExecutionAutoConfiguration.class]", - "scope": "singleton", - "type": "org.springframework.boot.task.TaskExecutorBuilder" - } -}}}} diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-beans-models/empty-live-beans-model.json b/headless-services/commons/commons-boot-app-cli/src/test/resources/live-beans-models/empty-live-beans-model.json deleted file mode 100644 index bd04ec71a..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-beans-models/empty-live-beans-model.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "context": "application", - "parent": null, - "beans": [ - ] - } -] diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-beans-models/simple-live-beans-model.json b/headless-services/commons/commons-boot-app-cli/src/test/resources/live-beans-models/simple-live-beans-model.json deleted file mode 100644 index f1dc99e12..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-beans-models/simple-live-beans-model.json +++ /dev/null @@ -1,35 +0,0 @@ -[ - { - "context": "application", - "parent": null, - "beans": [ - { - "bean": "dependencyA", - "aliases": [], - "scope": "singleton", - "type": "org.test.DependencyA", - "resource": "file [/test-projects/classes/org/test/DependencyA.class]", - "dependencies": [] - }, - { - "bean": "dependencyB", - "aliases": [], - "scope": "singleton", - "type": "org.test.DependencyB", - "resource": "file [/test-projects/classes/org/test/DependencyB.class]", - "dependencies": [] - }, - { - "bean": "myAutowiredComponent", - "aliases": [], - "scope": "singleton", - "type": "org.test.MyAutowiredComponent", - "resource": "file [/test-projects/classes/org/test/MyAutowiredComponent.class]", - "dependencies": [ - "dependencyA", - "dependencyB" - ] - } - ] - } -] \ No newline at end of file diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-beans-models/totally-empty-live-beans-model.json b/headless-services/commons/commons-boot-app-cli/src/test/resources/live-beans-models/totally-empty-live-beans-model.json deleted file mode 100644 index e69de29bb..000000000 diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-web-eureka.json b/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-web-eureka.json deleted file mode 100644 index a69ce71c4..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-web-eureka.json +++ /dev/null @@ -1,270 +0,0 @@ -{ - "contexts": { - "welcome-messages-1": { - "mappings": { - "dispatcherServlets": { - "dispatcherServlet": [ - { - "handler": "ResourceHttpRequestHandler [locations=[class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/], ServletContext resource [/], class path resource []], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@22fd98a9]]", - "predicate": "/**/favicon.ico" - }, - { - "handler": "public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)", - "predicate": "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator/health" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "handle", - "className": "org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping.OperationHandler", - "descriptor": "(Ljavax/servlet/http/HttpServletRequest;Ljava/util/Map;)Ljava/lang/Object;" - } - } - }, - { - "handler": "public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)", - "predicate": "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator/info" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "handle", - "className": "org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping.OperationHandler", - "descriptor": "(Ljavax/servlet/http/HttpServletRequest;Ljava/util/Map;)Ljava/lang/Object;" - } - } - }, - { - "handler": "protected java.util.Map> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)", - "predicate": "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "links", - "className": "org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping", - "descriptor": "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)Ljava/util/Map;" - } - } - }, - { - "handler": "public com.example.demo.Greeting com.example.demo.WelcomeMessageServiceApplication.greeting()", - "predicate": "{[/welcome],methods=[GET]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/welcome" - ], - "produces": [], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "greeting", - "className": "com.example.demo.WelcomeMessageServiceApplication", - "descriptor": "()Lcom/example/demo/Greeting;" - } - } - }, - { - "handler": "public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)", - "predicate": "{[/error]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [], - "patterns": [ - "/error" - ], - "produces": [], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "error", - "className": "org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController", - "descriptor": "(Ljavax/servlet/http/HttpServletRequest;)Lorg/springframework/http/ResponseEntity;" - } - } - }, - { - "handler": "public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)", - "predicate": "{[/error],produces=[text/html]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [], - "patterns": [ - "/error" - ], - "produces": [ - { - "negated": false, - "mediaType": "text/html" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "errorHtml", - "className": "org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController", - "descriptor": "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)Lorg/springframework/web/servlet/ModelAndView;" - } - } - }, - { - "handler": "ResourceHttpRequestHandler [locations=[class path resource [META-INF/resources/webjars/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@474c937f]]", - "predicate": "/webjars/**" - }, - { - "handler": "ResourceHttpRequestHandler [locations=[class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/], ServletContext resource [/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@6a7b18f7]]", - "predicate": "/**" - } - ] - }, - "servletFilters": [ - { - "name": "webMvcMetricsFilter", - "className": "org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter", - "urlPatternMappings": [ - "/*" - ], - "servletNameMappings": [] - }, - { - "name": "requestContextFilter", - "className": "org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter", - "urlPatternMappings": [ - "/*" - ], - "servletNameMappings": [] - }, - { - "name": "Tomcat WebSocket (JSR356) Filter", - "className": "org.apache.tomcat.websocket.server.WsFilter", - "urlPatternMappings": [ - "/*" - ], - "servletNameMappings": [] - }, - { - "name": "httpPutFormContentFilter", - "className": "org.springframework.boot.web.servlet.filter.OrderedHttpPutFormContentFilter", - "urlPatternMappings": [ - "/*" - ], - "servletNameMappings": [] - }, - { - "name": "hiddenHttpMethodFilter", - "className": "org.springframework.boot.web.servlet.filter.OrderedHiddenHttpMethodFilter", - "urlPatternMappings": [ - "/*" - ], - "servletNameMappings": [] - }, - { - "name": "characterEncodingFilter", - "className": "org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter", - "urlPatternMappings": [ - "/*" - ], - "servletNameMappings": [] - }, - { - "name": "httpTraceFilter", - "className": "org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter", - "urlPatternMappings": [ - "/*" - ], - "servletNameMappings": [] - } - ], - "servlets": [ - { - "mappings": [], - "name": "default", - "className": "org.apache.catalina.servlets.DefaultServlet" - }, - { - "mappings": [ - "/" - ], - "name": "dispatcherServlet", - "className": "org.springframework.web.servlet.DispatcherServlet" - } - ] - }, - "parentId": "welcome-messages-1" - }, - "bootstrap": { - "mappings": { - "dispatcherServlets": {}, - "servletFilters": [], - "servlets": [] - } - } - } -} \ No newline at end of file diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-web.json b/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-web.json deleted file mode 100644 index 7bfbb6568..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-web.json +++ /dev/null @@ -1,286 +0,0 @@ -{ - "contexts": { - "application": { - "mappings": { - "dispatcherServlets": { - "dispatcherServlet": [ - { - "handler": "ResourceHttpRequestHandler [locations=[class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/], ServletContext resource [/], class path resource []], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@34896ee2]]", - "predicate": "/**/favicon.ico" - }, - { - "handler": "public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)", - "predicate": "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator/health" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "handle", - "className": "org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping.OperationHandler", - "descriptor": "(Ljavax/servlet/http/HttpServletRequest;Ljava/util/Map;)Ljava/lang/Object;" - } - } - }, - { - "handler": "public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)", - "predicate": "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator/info" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "handle", - "className": "org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping.OperationHandler", - "descriptor": "(Ljavax/servlet/http/HttpServletRequest;Ljava/util/Map;)Ljava/lang/Object;" - } - } - }, - { - "handler": "protected java.util.Map> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)", - "predicate": "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "links", - "className": "org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping", - "descriptor": "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)Ljava/util/Map;" - } - } - }, - { - "handler": "public java.lang.String com.example.demo.MyController.getMethodName(java.lang.String)", - "predicate": "{[/hello],methods=[GET]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/hello" - ], - "produces": [], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "getMethodName", - "className": "com.example.demo.MyController", - "descriptor": "(Ljava/lang/String;)Ljava/lang/String;" - } - } - }, - { - "handler": "public java.lang.String com.example.demo.MyController.hello()", - "predicate": "{[/qq || /pp],methods=[GET]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/qq", - "/pp" - ], - "produces": [], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "hello", - "className": "com.example.demo.MyController", - "descriptor": "()Ljava/lang/String;" - } - } - }, - { - "handler": "public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)", - "predicate": "{[/error]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [], - "patterns": [ - "/error" - ], - "produces": [], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "error", - "className": "org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController", - "descriptor": "(Ljavax/servlet/http/HttpServletRequest;)Lorg/springframework/http/ResponseEntity;" - } - } - }, - { - "handler": "public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)", - "predicate": "{[/error],produces=[text/html]}", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [], - "patterns": [ - "/error" - ], - "produces": [ - { - "negated": false, - "mediaType": "text/html" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "errorHtml", - "className": "org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController", - "descriptor": "(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)Lorg/springframework/web/servlet/ModelAndView;" - } - } - }, - { - "handler": "ResourceHttpRequestHandler [locations=[class path resource [META-INF/resources/webjars/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@62daf04f]]", - "predicate": "/webjars/**" - }, - { - "handler": "ResourceHttpRequestHandler [locations=[class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/], ServletContext resource [/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver@1eb78885]]", - "predicate": "/**" - } - ] - }, - "servletFilters": [ - { - "name": "webMvcMetricsFilter", - "className": "org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter", - "servletNameMappings": [], - "urlPatternMappings": [ - "/*" - ] - }, - { - "name": "requestContextFilter", - "className": "org.springframework.boot.web.servlet.filter.OrderedRequestContextFilter", - "servletNameMappings": [], - "urlPatternMappings": [ - "/*" - ] - }, - { - "name": "Tomcat WebSocket (JSR356) Filter", - "className": "org.apache.tomcat.websocket.server.WsFilter", - "servletNameMappings": [], - "urlPatternMappings": [ - "/*" - ] - }, - { - "name": "httpPutFormContentFilter", - "className": "org.springframework.boot.web.servlet.filter.OrderedHttpPutFormContentFilter", - "servletNameMappings": [], - "urlPatternMappings": [ - "/*" - ] - }, - { - "name": "hiddenHttpMethodFilter", - "className": "org.springframework.boot.web.servlet.filter.OrderedHiddenHttpMethodFilter", - "servletNameMappings": [], - "urlPatternMappings": [ - "/*" - ] - }, - { - "name": "characterEncodingFilter", - "className": "org.springframework.boot.web.servlet.filter.OrderedCharacterEncodingFilter", - "servletNameMappings": [], - "urlPatternMappings": [ - "/*" - ] - }, - { - "name": "httpTraceFilter", - "className": "org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter", - "servletNameMappings": [], - "urlPatternMappings": [ - "/*" - ] - } - ], - "servlets": [ - { - "mappings": [], - "name": "default", - "className": "org.apache.catalina.servlets.DefaultServlet" - }, - { - "mappings": [ - "/" - ], - "name": "dispatcherServlet", - "className": "org.springframework.web.servlet.DispatcherServlet" - } - ] - } - } - } -} \ No newline at end of file diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-webflux-eureka.json b/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-webflux-eureka.json deleted file mode 100644 index 50419fe7f..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-webflux-eureka.json +++ /dev/null @@ -1,145 +0,0 @@ -{ - "contexts": { - "welcome-messages-1": { - "mappings": { - "dispatcherHandlers": { - "webHandler": [ - { - "predicate": "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "handler": "public org.reactivestreams.Publisher> org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping$ReadOperationHandler.handle(org.springframework.web.server.ServerWebExchange)", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator/health" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "handle", - "className": "org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping.ReadOperationHandler", - "descriptor": "(Lorg/springframework/web/server/ServerWebExchange;)Lorg/reactivestreams/Publisher;" - } - } - }, - { - "predicate": "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "handler": "public org.reactivestreams.Publisher> org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping$ReadOperationHandler.handle(org.springframework.web.server.ServerWebExchange)", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator/info" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "handle", - "className": "org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping.ReadOperationHandler", - "descriptor": "(Lorg/springframework/web/server/ServerWebExchange;)Lorg/reactivestreams/Publisher;" - } - } - }, - { - "predicate": "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "handler": "protected java.util.Map> org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping.links(org.springframework.web.server.ServerWebExchange)", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "links", - "className": "org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping", - "descriptor": "(Lorg/springframework/web/server/ServerWebExchange;)Ljava/util/Map;" - } - } - }, - { - "predicate": "{[/welcome],methods=[GET]}", - "handler": "public com.example.demo.Greeting com.example.demo.WelcomeMessageServiceApplication.greeting()", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/welcome" - ], - "produces": [], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "greeting", - "className": "com.example.demo.WelcomeMessageServiceApplication", - "descriptor": "()Lcom/example/demo/Greeting;" - } - } - }, - { - "predicate": "/webjars/**", - "handler": "ResourceWebHandler [locations=[class path resource [META-INF/resources/webjars/]], resolvers=[org.springframework.web.reactive.resource.PathResourceResolver@7030aee8]]" - }, - { - "predicate": "/**", - "handler": "ResourceWebHandler [locations=[class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.reactive.resource.PathResourceResolver@2c2efafe]]" - } - ] - } - }, - "parentId": "welcome-messages-1" - }, - "bootstrap": { - "mappings": { - "dispatcherHandlers": {} - } - } - } -} diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-webflux-functional.json b/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-webflux-functional.json deleted file mode 100644 index 6d889f58e..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-webflux-functional.json +++ /dev/null @@ -1,133 +0,0 @@ -{ - "contexts": { - "application": { - "mappings": { - "dispatcherHandlers": { - "webHandler": [ - { - "predicate": "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "handler": "public org.reactivestreams.Publisher> org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping$ReadOperationHandler.handle(org.springframework.web.server.ServerWebExchange)", - "details": { - "handlerFunction": null, - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator/health" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "handle", - "className": "org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping.ReadOperationHandler", - "descriptor": "(Lorg/springframework/web/server/ServerWebExchange;)Lorg/reactivestreams/Publisher;" - } - } - }, - { - "predicate": "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "handler": "public org.reactivestreams.Publisher> org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping$ReadOperationHandler.handle(org.springframework.web.server.ServerWebExchange)", - "details": { - "handlerFunction": null, - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator/info" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "handle", - "className": "org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping.ReadOperationHandler", - "descriptor": "(Lorg/springframework/web/server/ServerWebExchange;)Lorg/reactivestreams/Publisher;" - } - } - }, - { - "predicate": "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "handler": "protected java.util.Map> org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping.links(org.springframework.web.server.ServerWebExchange)", - "details": { - "handlerFunction": null, - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "links", - "className": "org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping", - "descriptor": "(Lorg/springframework/web/server/ServerWebExchange;)Ljava/util/Map;" - } - } - }, - { - "predicate": "((GET && /hello) && Accept: [text/plain])", - "handler": "hello.GreetingRouter$$Lambda$235/720770771@5ebd56e9", - "details": { - "handlerFunction": { - "className": "hello.GreetingRouter$$Lambda$235/720770771" - }, - "requestMappingConditions": null, - "handlerMethod": null - } - }, - { - "predicate": "/webjars/**", - "handler": "ResourceWebHandler [locations=[class path resource [META-INF/resources/webjars/]], resolvers=[org.springframework.web.reactive.resource.PathResourceResolver@347ce31]]", - "details": null - }, - { - "predicate": "/**", - "handler": "ResourceWebHandler [locations=[class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.reactive.resource.PathResourceResolver@2bdd186e]]", - "details": null - } - ] - } - }, - "parentId": null - } - } -} diff --git a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-webflux.json b/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-webflux.json deleted file mode 100644 index 983b92157..000000000 --- a/headless-services/commons/commons-boot-app-cli/src/test/resources/live-rm-beans/rms-boot2-webflux.json +++ /dev/null @@ -1,163 +0,0 @@ -{ - "contexts": { - "application": { - "mappings": { - "dispatcherHandlers": { - "webHandler": [ - { - "predicate": "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "handler": "public org.reactivestreams.Publisher> org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping$ReadOperationHandler.handle(org.springframework.web.server.ServerWebExchange)", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator/health" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "handle", - "className": "org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping.ReadOperationHandler", - "descriptor": "(Lorg/springframework/web/server/ServerWebExchange;)Lorg/reactivestreams/Publisher;" - } - } - }, - { - "predicate": "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "handler": "public org.reactivestreams.Publisher> org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping$ReadOperationHandler.handle(org.springframework.web.server.ServerWebExchange)", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator/info" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "handle", - "className": "org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping.ReadOperationHandler", - "descriptor": "(Lorg/springframework/web/server/ServerWebExchange;)Lorg/reactivestreams/Publisher;" - } - } - }, - { - "predicate": "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}", - "handler": "protected java.util.Map> org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping.links(org.springframework.web.server.ServerWebExchange)", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/actuator" - ], - "produces": [ - { - "negated": false, - "mediaType": "application/vnd.spring-boot.actuator.v2+json" - }, - { - "negated": false, - "mediaType": "application/json" - } - ], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "links", - "className": "org.springframework.boot.actuate.endpoint.web.reactive.WebFluxEndpointHandlerMapping", - "descriptor": "(Lorg/springframework/web/server/ServerWebExchange;)Ljava/util/Map;" - } - } - }, - { - "predicate": "{[/hello],methods=[GET]}", - "handler": "public java.lang.String com.example.demo.MyController.getMethodName(java.lang.String)", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/hello" - ], - "produces": [], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "getMethodName", - "className": "com.example.demo.MyController", - "descriptor": "(Ljava/lang/String;)Ljava/lang/String;" - } - } - }, - { - "predicate": "{[/pp || /qq],methods=[GET]}", - "handler": "public java.lang.String com.example.demo.MyController.hello()", - "details": { - "requestMappingConditions": { - "headers": [], - "methods": [ - "GET" - ], - "patterns": [ - "/pp", - "/qq" - ], - "produces": [], - "params": [], - "consumes": [] - }, - "handlerMethod": { - "name": "hello", - "className": "com.example.demo.MyController", - "descriptor": "()Ljava/lang/String;" - } - } - }, - { - "predicate": "/webjars/**", - "handler": "ResourceWebHandler [locations=[class path resource [META-INF/resources/webjars/]], resolvers=[org.springframework.web.reactive.resource.PathResourceResolver@5f115dc8]]" - }, - { - "predicate": "/**", - "handler": "ResourceWebHandler [locations=[class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.reactive.resource.PathResourceResolver@526469af]]" - } - ] - } - } - } - } -} diff --git a/headless-services/commons/language-server-test-harness/src/main/java/org/springframework/ide/vscode/languageserver/testharness/Editor.java b/headless-services/commons/language-server-test-harness/src/main/java/org/springframework/ide/vscode/languageserver/testharness/Editor.java index 899f9c51d..ddbe3a654 100644 --- a/headless-services/commons/language-server-test-harness/src/main/java/org/springframework/ide/vscode/languageserver/testharness/Editor.java +++ b/headless-services/commons/language-server-test-harness/src/main/java/org/springframework/ide/vscode/languageserver/testharness/Editor.java @@ -12,6 +12,7 @@ package org.springframework.ide.vscode.languageserver.testharness; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness.getDocString; @@ -225,6 +226,11 @@ public class Editor { return ranges; } + public void assertNoHighlights() throws Exception { + HighlightParams highlights = harness.getHighlights(false, doc); + assertNull(highlights); + } + /** * Get the editor text, with cursor markers inserted (for easy textual comparison * after applying a proposal) diff --git a/headless-services/commons/pom.xml b/headless-services/commons/pom.xml index adaad10e3..f30668ad7 100644 --- a/headless-services/commons/pom.xml +++ b/headless-services/commons/pom.xml @@ -41,7 +41,6 @@ commons-cf commons-maven commons-gradle - commons-boot-app-cli language-server-starter diff --git a/headless-services/spring-boot-language-server/pom.xml b/headless-services/spring-boot-language-server/pom.xml index bfd74399b..01ecd45f8 100644 --- a/headless-services/spring-boot-language-server/pom.xml +++ b/headless-services/spring-boot-language-server/pom.xml @@ -77,11 +77,6 @@ commons-language-server ${dependencies.version} - - org.springframework.ide.vscode - commons-boot-app-cli - ${dependencies.version} - org.eclipse.jdt org.eclipse.jdt.core @@ -92,6 +87,11 @@ commons-io ${commons-io-version} + + org.json + json + 20160810 + org.lsp4xml org.eclipse.lsp4xml @@ -134,6 +134,28 @@ test + + + + tools-jar-profile + + + ${java.home}/../lib/tools.jar + + + + + + com.sun + tools + 1.8.0 + system + ${java.home}/../lib/tools.jar + + + + + diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/BootLanguagServerBootApp.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/BootLanguagServerBootApp.java index 26a11c66f..0d07f446e 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/BootLanguagServerBootApp.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/BootLanguagServerBootApp.java @@ -23,7 +23,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.ide.vscode.boot.common.PropertyCompletionFactory; import org.springframework.ide.vscode.boot.common.RelaxedNameConfig; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; import org.springframework.ide.vscode.boot.java.links.DefaultJavaElementLocationProvider; import org.springframework.ide.vscode.boot.java.links.EclipseJavaDocumentUriProvider; import org.springframework.ide.vscode.boot.java.links.JavaDocumentUriProvider; @@ -32,6 +31,7 @@ import org.springframework.ide.vscode.boot.java.links.JavaServerElementLocationP import org.springframework.ide.vscode.boot.java.links.JdtJavaDocumentUriProvider; import org.springframework.ide.vscode.boot.java.links.SourceLinkFactory; import org.springframework.ide.vscode.boot.java.links.SourceLinks; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; import org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache; import org.springframework.ide.vscode.boot.java.utils.SymbolCache; import org.springframework.ide.vscode.boot.java.utils.SymbolCacheOnDisc; @@ -94,10 +94,9 @@ public class BootLanguagServerBootApp { } } - @ConditionalOnMissingClass("org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness") @Bean - RunningAppProvider runningAppProvider(SimpleLanguageServer server) { - return RunningAppProvider.createDefault(server); + SpringProcessLiveDataProvider liveDataProvider() { + return new SpringProcessLiveDataProvider(); } @ConditionalOnMissingClass("org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness") diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/BootLanguageServerInitializer.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/BootLanguageServerInitializer.java index 634cba2a1..c8e39a93c 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/BootLanguageServerInitializer.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/BootLanguageServerInitializer.java @@ -16,9 +16,9 @@ import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; import org.springframework.ide.vscode.boot.java.links.JavaElementLocationProvider; import org.springframework.ide.vscode.boot.java.links.SourceLinks; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; import org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache; import org.springframework.ide.vscode.boot.java.utils.SymbolCache; import org.springframework.ide.vscode.boot.metadata.ProjectBasedPropertyIndexProvider; @@ -51,9 +51,9 @@ public class BootLanguageServerInitializer implements InitializingBean { @Autowired YamlStructureProvider yamlStructureProvider; @Autowired YamlAssistContextProvider yamlAssistContextProvider; @Autowired SymbolCache symbolCache; + @Autowired SpringProcessLiveDataProvider liveDataProvider; @Autowired BootJavaConfig config; @Autowired SpringSymbolIndex springIndexer; - @Autowired RunningAppProvider runningAppProvider; @Qualifier("adHocProperties") @Autowired ProjectBasedPropertyIndexProvider adHocProperties; @@ -81,7 +81,7 @@ public class BootLanguageServerInitializer implements InitializingBean { // some server intialization code. Migrate that code and get rid of the ComposableLanguageServer class CompositeLanguageServerComponents.Builder builder = new CompositeLanguageServerComponents.Builder(); builder.add(new BootPropertiesLanguageServerComponents(server, params, javaElementLocationProvider, parser, yamlStructureProvider, yamlAssistContextProvider, sourceLinks)); - builder.add(new BootJavaLanguageServerComponents(server, params, sourceLinks, cuCache, adHocProperties, symbolCache, config, springIndexer, runningAppProvider)); + builder.add(new BootJavaLanguageServerComponents(server, params, sourceLinks, cuCache, adHocProperties, symbolCache, liveDataProvider, config, springIndexer)); builder.add(new SpringXMLLanguageServerComponents(server, springIndexer, params, config)); components = builder.build(server); params.projectObserver.addListener(reconcileOpenDocuments(server, components, params.projectFinder)); diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/BootLanguageServerParams.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/BootLanguageServerParams.java index 92eae3f70..de4f3380f 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/BootLanguageServerParams.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/BootLanguageServerParams.java @@ -11,18 +11,12 @@ package org.springframework.ide.vscode.boot.app; import java.nio.file.Paths; -import java.time.Duration; import java.util.Arrays; import java.util.Collection; import java.util.Optional; import org.eclipse.lsp4j.TextDocumentIdentifier; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; import org.springframework.ide.vscode.boot.java.links.SourceLinks; -import org.springframework.ide.vscode.boot.java.utils.SpringLiveHoverWatchdog; -import org.springframework.ide.vscode.boot.java.utils.SymbolCache; -import org.springframework.ide.vscode.boot.java.utils.SymbolCacheOnDisc; -import org.springframework.ide.vscode.boot.java.utils.SymbolCacheVoid; import org.springframework.ide.vscode.boot.jdt.ls.JavaProjectsService; import org.springframework.ide.vscode.boot.jdt.ls.JavaProjectsServiceWithFallback; import org.springframework.ide.vscode.boot.jdt.ls.JdtLsProjectCache; @@ -75,16 +69,11 @@ public class BootLanguageServerParams { //Boot Properies public final TypeUtilProvider typeUtilProvider; - //Boot Java - //public final RunningAppProvider runningAppProvider; - public final Duration watchDogInterval; - public BootLanguageServerParams( JavaProjectFinder projectFinder, ProjectObserver projectObserver, SpringPropertyIndexProvider indexProvider, - TypeUtilProvider typeUtilProvider, - Duration watchDogInterval + TypeUtilProvider typeUtilProvider ) { super(); Assert.isNotNull(projectObserver); // null is bad should be ProjectObserver.NULL @@ -92,7 +81,6 @@ public class BootLanguageServerParams { this.projectObserver = projectObserver; this.indexProvider = indexProvider; this.typeUtilProvider = typeUtilProvider; - this.watchDogInterval = watchDogInterval; } public static BootLanguageServerParams createDefault(SimpleLanguageServer server, ValueProviderRegistry valueProviders, boolean isJandexIndex) { @@ -111,8 +99,7 @@ public class BootLanguageServerParams { jdtProjectCache.filter(project -> SpringProjectUtil.isBootProject(project) || SpringProjectUtil.isSpringProject(project)), jdtProjectCache, indexProvider, - (SourceLinks sourceLinks, IDocument doc) -> new TypeUtil(sourceLinks, jdtProjectCache.find(new TextDocumentIdentifier(doc.getUri()))), - SpringLiveHoverWatchdog.DEFAULT_INTERVAL + (SourceLinks sourceLinks, IDocument doc) -> new TypeUtil(sourceLinks, jdtProjectCache.find(new TextDocumentIdentifier(doc.getUri()))) ); } @@ -178,8 +165,7 @@ public class BootLanguageServerParams { javaProjectFinder.filter(project -> SpringProjectUtil.isBootProject(project) || SpringProjectUtil.isSpringProject(project)), projectObserver, indexProvider, - (SourceLinks sourceLinks, IDocument doc) -> new TypeUtil(sourceLinks, javaProjectFinder.find(new TextDocumentIdentifier(doc.getUri()))), - SpringLiveHoverWatchdog.DEFAULT_INTERVAL + (SourceLinks sourceLinks, IDocument doc) -> new TypeUtil(sourceLinks, javaProjectFinder.find(new TextDocumentIdentifier(doc.getUri()))) ); } } diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/BootJavaLanguageServerComponents.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/BootJavaLanguageServerComponents.java index 4c9000262..547121bb7 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/BootJavaLanguageServerComponents.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/BootJavaLanguageServerComponents.java @@ -18,8 +18,6 @@ import java.util.Map; import java.util.Set; import org.eclipse.lsp4j.CompletionItemKind; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.ide.vscode.boot.app.BootJavaConfig; import org.springframework.ide.vscode.boot.app.BootLanguageServerParams; import org.springframework.ide.vscode.boot.app.SpringSymbolIndex; @@ -39,7 +37,6 @@ import org.springframework.ide.vscode.boot.java.handlers.CompletionProvider; import org.springframework.ide.vscode.boot.java.handlers.HighlightProvider; import org.springframework.ide.vscode.boot.java.handlers.HoverProvider; import org.springframework.ide.vscode.boot.java.handlers.ReferenceProvider; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; import org.springframework.ide.vscode.boot.java.links.SourceLinks; import org.springframework.ide.vscode.boot.java.livehover.ActiveProfilesProvider; import org.springframework.ide.vscode.boot.java.livehover.BeanInjectedIntoHoverProvider; @@ -100,8 +97,6 @@ public class BootJavaLanguageServerComponents implements LanguageServerComponent public static final Set LANGUAGES = ImmutableSet.of(LanguageId.JAVA, LanguageId.CLASS); - private static final Logger log = LoggerFactory.getLogger(BootJavaLanguageServerComponents.class); - private final SimpleLanguageServer server; private final BootLanguageServerParams serverParams; private final SpringPropertyIndexProvider propertyIndexProvider; @@ -129,9 +124,9 @@ public class BootJavaLanguageServerComponents implements LanguageServerComponent CompilationUnitCache cuCache, ProjectBasedPropertyIndexProvider adHocIndexProvider, SymbolCache symbolCache, + SpringProcessLiveDataProvider liveDataProvider, BootJavaConfig config, - SpringSymbolIndex indexer, - RunningAppProvider runningAppProvider + SpringSymbolIndex indexer ) { this.server = server; this.serverParams = serverParams; @@ -148,11 +143,8 @@ public class BootJavaLanguageServerComponents implements LanguageServerComponent ReferencesHandler referencesHandler = createReferenceHandler(server, projectFinder); documents.onReferences(referencesHandler); - - - documents.onDocumentSymbol(new BootJavaDocumentSymbolHandler(indexer)); - workspaceService.onWorkspaceSymbol(new BootJavaWorkspaceSymbolHandler(indexer, - new LiveAppURLSymbolProvider(runningAppProvider))); + + this.liveDataProvider = liveDataProvider; // @@ -160,7 +152,6 @@ public class BootJavaLanguageServerComponents implements LanguageServerComponent // // central live data components (to coordinate live data flow) - liveDataProvider = new SpringProcessLiveDataProvider(); liveDataService = new SpringProcessConnectorService(liveDataProvider); // connect the live data provider with the hovers (for data extraction and live updates) @@ -184,13 +175,17 @@ public class BootJavaLanguageServerComponents implements LanguageServerComponent // + documents.onDocumentSymbol(new BootJavaDocumentSymbolHandler(indexer)); + workspaceService.onWorkspaceSymbol(new BootJavaWorkspaceSymbolHandler(indexer, + new LiveAppURLSymbolProvider(liveDataProvider))); + + liveChangeDetectionWatchdog = new SpringLiveChangeDetectionWatchdog( this, server, serverParams.projectObserver, - runningAppProvider, projectFinder, - serverParams.watchDogInterval, + Duration.ofSeconds(5), sourceLinks); codeLensHandler = createCodeLensEngine(indexer); @@ -200,16 +195,10 @@ public class BootJavaLanguageServerComponents implements LanguageServerComponent documents.onDocumentHighlight(highlightsEngine); config.addListener(ignore -> { - // live hover watchdog + // live information automatic process tracking liveProcessTracker.setDelay(config.getLiveInformationAutomaticTrackingDelay()); liveProcessTracker.setTrackingEnabled(config.isLiveInformationAutomaticTrackingEnabled()); - // if (config.isBootHintsEnabled()) { -// liveHoverWatchdog.enableHighlights(); -// } else { -// liveHoverWatchdog.disableHighlights(); -// } - // live change detection watchdog if (config.isChangeDetectionEnabled()) { liveChangeDetectionWatchdog.enableHighlights(); diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/HoverProvider.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/HoverProvider.java index 07452aa61..2af069787 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/HoverProvider.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/HoverProvider.java @@ -21,7 +21,6 @@ import org.eclipse.jdt.core.dom.TypeDeclaration; import org.eclipse.lsp4j.CodeLens; import org.eclipse.lsp4j.Hover; import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveData; -import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp; import org.springframework.ide.vscode.commons.java.IJavaProject; import org.springframework.ide.vscode.commons.util.text.TextDocument; diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/RemoteRunningAppsProvider.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/RemoteRunningAppsProvider.java deleted file mode 100644 index 514c68eac..000000000 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/RemoteRunningAppsProvider.java +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018, 2019 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.vscode.boot.java.handlers; - -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.ide.vscode.commons.boot.app.cli.RemoteSpringBootApp; -import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp; -import org.springframework.ide.vscode.commons.languageserver.util.Settings; -import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer; -import org.springframework.ide.vscode.commons.util.CollectorUtil; - -public class RemoteRunningAppsProvider implements RunningAppProvider { - - public static class RemoteBootAppData { - - private String jmxurl; - private String host; - private String urlScheme = "https"; - private String port = "443"; - private boolean keepChecking = true; - //keepChecking defaults to true. Boot dash automatic remote apps should override this explicitly. - //Reason. All other 'sources' of remote apps are 'manual' and we want them to default to - //'keepChecking' even if the user doesn't set this to true manually. - - public String getJmxurl() { - return jmxurl; - } - - public void setJmxurl(String jmxurl) { - this.jmxurl = jmxurl; - } - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public String getUrlScheme() { - return urlScheme; - } - - public void setUrlScheme(String urlScheme) { - this.urlScheme = urlScheme; - } - - public String getPort() { - return port; - } - - public void setPort(String port) { - this.port = port; - } - - public boolean isKeepChecking() { - return keepChecking; - } - - public void setKeepChecking(boolean keepChecking) { - this.keepChecking = keepChecking; - } - - @Override - public String toString() { - return "RemoteBootAppData [jmxurl=" + jmxurl + ", host=" + host + ", urlScheme=" + urlScheme + ", port=" - + port + ", keepChecking=" + keepChecking + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((host == null) ? 0 : host.hashCode()); - result = prime * result + ((jmxurl == null) ? 0 : jmxurl.hashCode()); - result = prime * result + (keepChecking ? 1231 : 1237); - result = prime * result + ((port == null) ? 0 : port.hashCode()); - result = prime * result + ((urlScheme == null) ? 0 : urlScheme.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - RemoteBootAppData other = (RemoteBootAppData) obj; - if (host == null) { - if (other.host != null) - return false; - } else if (!host.equals(other.host)) - return false; - if (jmxurl == null) { - if (other.jmxurl != null) - return false; - } else if (!jmxurl.equals(other.jmxurl)) - return false; - if (keepChecking != other.keepChecking) - return false; - if (port == null) { - if (other.port != null) - return false; - } else if (!port.equals(other.port)) - return false; - if (urlScheme == null) { - if (other.urlScheme != null) - return false; - } else if (!urlScheme.equals(other.urlScheme)) - return false; - return true; - } - - } - - private static Logger logger = LoggerFactory.getLogger(RemoteRunningAppsProvider.class); - - /** - * We keep the remote app instances in a Map indexed by the json daya. This allows us to - * return the same instance(s) repeatedly as long as the data does not change. - */ - private Map remoteAppInstances = new HashMap<>(); - - public RemoteRunningAppsProvider(SimpleLanguageServer server) { -// server.getWorkspaceService().onDidChangeConfiguraton(this::handleSettings); - } - - @Override - public synchronized Collection getAllRunningSpringApps() throws Exception { - return remoteAppInstances.values().stream().filter(SpringBootApp::hasUsefulJmxBeans).collect(CollectorUtil.toImmutableList()); - } - - synchronized void handleSettings(Settings settings) { -// RemoteBootAppData[] appData = settings.getAs(RemoteBootAppData[].class, "boot-java", "remote-apps"); -// if (appData==null) { -// //Avoid NPE -// appData = new RemoteBootAppData[0]; -// } -// -// Set newAppData = new HashSet<>(Arrays.asList(appData)); -// { //Remove obsolete apps -// Iterator> entries = remoteAppInstances.entrySet().iterator(); -// while (entries.hasNext()) { -// Entry entry = entries.next(); -// RemoteBootAppData key = entry.getKey(); -// if (!newAppData.contains(key)) { -// logger.info("Removing RemoteSpringBootApp: "+key); -// entries.remove(); -// entry.getValue().dispose(); -// } -// } -// } -// -// { //Add new apps -// for (RemoteBootAppData key : newAppData) { -// remoteAppInstances.computeIfAbsent(key, (_key) -> { -// logger.info("Creating RemoteStringBootApp: "+_key); -// return RemoteSpringBootApp.create(key.getJmxurl(), key.getHost(), key.getPort(), key.getUrlScheme(), key.isKeepChecking()); -// }); -// } -// } - } - -} diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/RunningAppMatcher.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/RunningAppMatcher.java deleted file mode 100644 index 50ef0a612..000000000 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/RunningAppMatcher.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2018, 2019 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.vscode.boot.java.handlers; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp; -import org.springframework.ide.vscode.commons.java.IClasspath; -import org.springframework.ide.vscode.commons.java.IJavaProject; -import org.springframework.ide.vscode.commons.protocol.java.Classpath; -import org.springframework.ide.vscode.commons.protocol.java.Classpath.CPE; -import org.springframework.ide.vscode.commons.util.CollectorUtil; - -/** - * @author Martin Lippert - */ -public class RunningAppMatcher { - - public static Collection getAllMatchingApps(Collection apps, IJavaProject project) throws Exception { - if (project != null) { - Collection matchedProjects = apps.stream().filter((app) -> { - return RunningAppMatcher.doesProjectMatch(app, project); - }).collect(CollectorUtil.toImmutableList()); - - return matchedProjects; - } - return apps; - } - - private static boolean doesProjectMatch(SpringBootApp app, IJavaProject project) { - if (hasProjectName(app, project)) { - return doesProjectNameMatch(app, project); - } - return true; - } - - public static boolean hasProjectName(SpringBootApp app, IJavaProject project) { - try { - String projectName = app.getSystemProperty("spring.boot.project.name"); - return projectName != null && projectName.trim().length() > 0; - } - catch (Exception e) { - return false; - } - } - - public static boolean doesProjectNameMatch(SpringBootApp app, IJavaProject project) { - try { - String projectName = app.getSystemProperty("spring.boot.project.name"); - return projectName != null && project != null && projectName.equals(project.getElementName()); - } - catch (Exception e) { - return false; - } - } - - public static boolean doesClasspathMatch(SpringBootApp app, IJavaProject project) { - try { - Set runningAppClasspath = new HashSet<>(); - Collections.addAll(runningAppClasspath, app.getClasspath()); - - return doesClasspathMatch(runningAppClasspath, project); - } - catch (Exception e) { - return false; - } - } - - public static boolean doesClasspathMatch(Set runningAppClasspath, IJavaProject project) throws Exception { - IClasspath classpath = project.getClasspath(); - Collection entries = classpath.getClasspathEntries(); - for (CPE cpe : entries) { - if (Classpath.ENTRY_KIND_SOURCE.equals(cpe.getKind())) { - String path = cpe.getOutputFolder(); - if (runningAppClasspath.contains(path)) { - return true; - } - } - } - - return false; - } - - public static boolean doesProjectThinJarWrapperMatch(SpringBootApp app, IJavaProject project) { - // not yet implemented - return false; - } - -} diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/RunningAppProvider.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/RunningAppProvider.java deleted file mode 100644 index b818c9741..000000000 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/RunningAppProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017, 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 - * https://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.vscode.boot.java.handlers; - -import java.util.Collection; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -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.languageserver.util.SimpleLanguageServer; - -import com.google.common.collect.ImmutableList; - -public interface RunningAppProvider { - - static final Logger log = LoggerFactory.getLogger(RunningAppProvider.class); - - static RunningAppProvider composite(RunningAppProvider... children) { - if (children.length==1) { - return children[0]; - } - return () -> { - ImmutableList.Builder allApps = ImmutableList.builder(); - for (RunningAppProvider c : children) { - Collection moreApps = c.getAllRunningSpringApps(); - if (moreApps!=null) { - allApps.addAll(moreApps); - } - } - return allApps.build(); - }; - } - - // Don't put LocalSpringBootApp::getAllRunningSpringApps, thus class loading doesn't fail if LS launched with JRE instead of JDK - public static final RunningAppProvider LOCAL_APPS = () -> LocalSpringBootApp.getAllRunningSpringApps(); - - public static final RunningAppProvider NULL = () -> ImmutableList.of(); - - Collection getAllRunningSpringApps() throws Exception; - - static RunningAppProvider createDefault(SimpleLanguageServer server) { - try { - return composite(LOCAL_APPS, new RemoteRunningAppsProvider(server)); - } catch (Throwable t) { - log.error("", t); - } - return NULL; - } -} diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/LiveRequestMappingBoot1xRequestMapping.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/LiveRequestMappingBoot1xRequestMapping.java index 02ba8ecfe..2bdab9a8e 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/LiveRequestMappingBoot1xRequestMapping.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/LiveRequestMappingBoot1xRequestMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2017 Pivotal, Inc. + * Copyright (c) 2017, 2019 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 diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/LiveRequestMappingBoot2xDispatcherServletMapping.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/LiveRequestMappingBoot2xDispatcherServletMapping.java index 51f49b1e9..fc812099c 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/LiveRequestMappingBoot2xDispatcherServletMapping.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/LiveRequestMappingBoot2xDispatcherServletMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 Pivotal, Inc. + * Copyright (c) 2018, 2019 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 @@ -18,7 +18,7 @@ import java.util.Set; import org.json.JSONArray; import org.json.JSONObject; -import org.objectweb.asm.Type; +import org.springframework.asm.Type; public class LiveRequestMappingBoot2xDispatcherServletMapping implements LiveRequestMapping { diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/requestmapping/LiveAppURLSymbolProvider.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/requestmapping/LiveAppURLSymbolProvider.java index 3eb39aadd..a98954da6 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/requestmapping/LiveAppURLSymbolProvider.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/requestmapping/LiveAppURLSymbolProvider.java @@ -13,16 +13,10 @@ package org.springframework.ide.vscode.boot.java.requestmapping; import java.util.ArrayList; import java.util.List; -import org.eclipse.lsp4j.Location; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.Range; import org.eclipse.lsp4j.SymbolInformation; -import org.eclipse.lsp4j.SymbolKind; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveRequestMapping; -import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; /** * @author Martin Lippert @@ -31,10 +25,10 @@ public class LiveAppURLSymbolProvider { private static final Logger log = LoggerFactory.getLogger(LiveAppURLSymbolProvider.class); - private final RunningAppProvider runningAppProvider; + private final SpringProcessLiveDataProvider liveDataProvider; - public LiveAppURLSymbolProvider(RunningAppProvider runningAppProvider) { - this.runningAppProvider = runningAppProvider; + public LiveAppURLSymbolProvider(SpringProcessLiveDataProvider liveDataProvider) { + this.liveDataProvider = liveDataProvider; } public List getSymbols(String query) { diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/Change.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/Change.java index 19d9dc22d..f310dc11b 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/Change.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/Change.java @@ -14,26 +14,25 @@ import java.util.ArrayList; import java.util.List; import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBean; -import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp; /** * @author Martin Lippert */ public class Change { - private final SpringBootApp runningApp; +// private final SpringBootApp runningApp; private List newBeans; private List deletedBeans; - public Change(SpringBootApp runningApp) { - this.runningApp = runningApp; - } - - public SpringBootApp getRunningApp() { - return runningApp; - } - +// public Change(SpringBootApp runningApp) { +// this.runningApp = runningApp; +// } +// +// public SpringBootApp getRunningApp() { +// return runningApp; +// } +// public List getNewBeans() { return newBeans; } diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/ChangeDetectionHistory.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/ChangeDetectionHistory.java index 9522308a9..6973d86db 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/ChangeDetectionHistory.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/ChangeDetectionHistory.java @@ -10,14 +10,8 @@ *******************************************************************************/ package org.springframework.ide.vscode.boot.java.utils; -import java.io.IOException; -import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; -import java.util.Set; - -import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp; /** * @author Martin Lippert @@ -30,97 +24,97 @@ public class ChangeDetectionHistory { this.changeHistory = new HashMap<>(); } - public Change[] checkForChanges(SpringBootApp[] runningApps) { - List result = null; - - for (SpringBootApp runningApp : runningApps) { - String virtualID = getVirtualAppID(runningApp); - - if (changeHistory.containsKey(virtualID)) { - // the standard case - ChangeHistory appHistory = changeHistory.get(virtualID); - appHistory.updateProcess(runningApp); - - Change change = appHistory.checkForUpdates(); - if (change != null) { - if (result == null) { - result = new ArrayList<>(); - } - result.add(change); - } - } - else { - String oldAppID = getOldApp(runningApp, runningApps); - if (oldAppID != null) { - ChangeHistory oldHistory = changeHistory.remove(oldAppID); - oldHistory.updateProcess(runningApp); - changeHistory.put(virtualID, oldHistory); - - Change change = oldHistory.checkForUpdates(); - if (change != null) { - if (result == null) { - result = new ArrayList<>(); - } - result.add(change); - } - } - else { - ChangeHistory newHistory = new ChangeHistory(); - newHistory.updateProcess(runningApp); - changeHistory.put(virtualID, newHistory); - - newHistory.checkForUpdates(); - } - } - } - - if (result != null) { - return (Change[]) result.toArray(new Change[result.size()]); - } - else { - return null; - } - } - - private String getVirtualAppID(SpringBootApp app) { - return app.getProcessID(); - } - - private String getOldApp(SpringBootApp app, SpringBootApp[] allApps) { - Set histories = this.changeHistory.keySet(); - - try { - String commandLine = app.getJavaCommand(); - String[] classpath = app.getClasspath(); - - for (String oldProcessID : histories) { - if (this.changeHistory.get(oldProcessID).matchesProcess(commandLine, classpath) - && processNotRunningAnymore(oldProcessID, allApps)) { - return oldProcessID; - } - } - } - catch (Exception e) { - e.printStackTrace(); - } - - return null; - } - - private boolean processNotRunningAnymore(String oldProcessID, SpringBootApp[] allApps) { - try { - for (SpringBootApp app : allApps) { - String id = getVirtualAppID(app); - if (id != null && id.equals(oldProcessID)) { - return false; - } - } - } - catch (Exception e) { - e.printStackTrace(); - } - - return true; - } +// public Change[] checkForChanges(SpringBootApp[] runningApps) { +// List result = null; +// +// for (SpringBootApp runningApp : runningApps) { +// String virtualID = getVirtualAppID(runningApp); +// +// if (changeHistory.containsKey(virtualID)) { +// // the standard case +// ChangeHistory appHistory = changeHistory.get(virtualID); +// appHistory.updateProcess(runningApp); +// +// Change change = appHistory.checkForUpdates(); +// if (change != null) { +// if (result == null) { +// result = new ArrayList<>(); +// } +// result.add(change); +// } +// } +// else { +// String oldAppID = getOldApp(runningApp, runningApps); +// if (oldAppID != null) { +// ChangeHistory oldHistory = changeHistory.remove(oldAppID); +// oldHistory.updateProcess(runningApp); +// changeHistory.put(virtualID, oldHistory); +// +// Change change = oldHistory.checkForUpdates(); +// if (change != null) { +// if (result == null) { +// result = new ArrayList<>(); +// } +// result.add(change); +// } +// } +// else { +// ChangeHistory newHistory = new ChangeHistory(); +// newHistory.updateProcess(runningApp); +// changeHistory.put(virtualID, newHistory); +// +// newHistory.checkForUpdates(); +// } +// } +// } +// +// if (result != null) { +// return (Change[]) result.toArray(new Change[result.size()]); +// } +// else { +// return null; +// } +// } +// +// private String getVirtualAppID(SpringBootApp app) { +// return app.getProcessID(); +// } +// +// private String getOldApp(SpringBootApp app, SpringBootApp[] allApps) { +// Set histories = this.changeHistory.keySet(); +// +// try { +// String commandLine = app.getJavaCommand(); +// String[] classpath = app.getClasspath(); +// +// for (String oldProcessID : histories) { +// if (this.changeHistory.get(oldProcessID).matchesProcess(commandLine, classpath) +// && processNotRunningAnymore(oldProcessID, allApps)) { +// return oldProcessID; +// } +// } +// } +// catch (Exception e) { +// e.printStackTrace(); +// } +// +// return null; +// } +// +// private boolean processNotRunningAnymore(String oldProcessID, SpringBootApp[] allApps) { +// try { +// for (SpringBootApp app : allApps) { +// String id = getVirtualAppID(app); +// if (id != null && id.equals(oldProcessID)) { +// return false; +// } +// } +// } +// catch (Exception e) { +// e.printStackTrace(); +// } +// +// return true; +// } } diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/ChangeHistory.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/ChangeHistory.java index 8a5197201..f464dcb43 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/ChangeHistory.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/ChangeHistory.java @@ -10,130 +10,119 @@ *******************************************************************************/ package org.springframework.ide.vscode.boot.java.utils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.commons.lang3.StringUtils; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBean; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBeansModel; -import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp; - /** * @author Martin Lippert */ public class ChangeHistory { - private static final List EMPTY_BEANS_LIST = new ArrayList<>(0); - - private SpringBootApp associatedProcess; - private String associatedProcessCommand; - private String[] associatedProcessClasspath; - - private LiveBeansModel lastBeans; - - public ChangeHistory() { - } - - public void updateProcess(SpringBootApp app) { - if (this.associatedProcess != app) { - this.associatedProcess = app; - - try { - this.associatedProcessCommand = app.getJavaCommand(); - this.associatedProcessClasspath = app.getClasspath(); - } - catch (Exception e) { - e.printStackTrace(); - } - } - } - - public boolean matchesProcess(String commandLine, String[] classpath) { - return this.associatedProcessCommand != null && this.associatedProcessCommand.equals(commandLine) - && this.associatedProcessClasspath != null && Arrays.deepEquals(this.associatedProcessClasspath, classpath); - } - - public Change checkForUpdates() { - Change result = null; - -// LiveBeansModel currentBeans = this.associatedProcess.getBeans(); -// if (!currentBeans.isEmpty()) { +// private static final List EMPTY_BEANS_LIST = new ArrayList<>(0); // -// if (lastBeans == null) { -// lastBeans = currentBeans; +// private SpringBootApp associatedProcess; +// private String associatedProcessCommand; +// private String[] associatedProcessClasspath; +// +// private LiveBeansModel lastBeans; +// +// public ChangeHistory() { +// } +// +// public void updateProcess(SpringBootApp app) { +// if (this.associatedProcess != app) { +// this.associatedProcess = app; +// +// try { +// this.associatedProcessCommand = app.getJavaCommand(); +// this.associatedProcessClasspath = app.getClasspath(); // } -// else if (lastBeans != null && currentBeans != null) { -// result = calculateBeansDiff(lastBeans, currentBeans, result); -// lastBeans = currentBeans; +// catch (Exception e) { +// e.printStackTrace(); // } // } - - return result; - } - - private Change calculateBeansDiff(LiveBeansModel previous, LiveBeansModel current, Change result) { - if (previous == current) { - return result; - } - - Set currentNames = current.getBeanNames(); - Set previousNames = previous.getBeanNames(); - - Set allNames = new HashSet<>(currentNames); - allNames.addAll(previousNames); - - for (String name : allNames) { - List currentBeans = current.getBeansOfName(name); - List previousBeans = previous.getBeansOfName(name); - - result = calculateBeansDiff(previousBeans, currentBeans, result); - } - - return result; - } - - private Change calculateBeansDiff(List previousBeans, List currentBeans, Change result) { - if (currentBeans == null) currentBeans = EMPTY_BEANS_LIST; - if (previousBeans == null) previousBeans = EMPTY_BEANS_LIST; - - for (LiveBean bean : previousBeans) { - if (!contains(currentBeans, bean)) { - - if (result == null) { - result = new Change(associatedProcess); - } - - result.addDeletedBean(bean); - } - } - - for (LiveBean bean : currentBeans) { - if (!contains(previousBeans, bean)) { - - if (result == null) { - result = new Change(associatedProcess); - } - - result.addNewBean(bean); - } - } - - return result; - } - - private boolean contains(List beans, LiveBean bean) { - for (LiveBean beansFromList : beans) { - if (StringUtils.equals(beansFromList.getId(), bean.getId()) - && StringUtils.equals(beansFromList.getType(true), bean.getType(true)) - && StringUtils.equals(beansFromList.getResource(), bean.getResource())) { - return true; - } - } - - return false; - } +// } +// +// public boolean matchesProcess(String commandLine, String[] classpath) { +// return this.associatedProcessCommand != null && this.associatedProcessCommand.equals(commandLine) +// && this.associatedProcessClasspath != null && Arrays.deepEquals(this.associatedProcessClasspath, classpath); +// } +// +// public Change checkForUpdates() { +// Change result = null; +// +//// LiveBeansModel currentBeans = this.associatedProcess.getBeans(); +//// if (!currentBeans.isEmpty()) { +//// +//// if (lastBeans == null) { +//// lastBeans = currentBeans; +//// } +//// else if (lastBeans != null && currentBeans != null) { +//// result = calculateBeansDiff(lastBeans, currentBeans, result); +//// lastBeans = currentBeans; +//// } +//// } +// +// return result; +// } +// +// private Change calculateBeansDiff(LiveBeansModel previous, LiveBeansModel current, Change result) { +// if (previous == current) { +// return result; +// } +// +// Set currentNames = current.getBeanNames(); +// Set previousNames = previous.getBeanNames(); +// +// Set allNames = new HashSet<>(currentNames); +// allNames.addAll(previousNames); +// +// for (String name : allNames) { +// List currentBeans = current.getBeansOfName(name); +// List previousBeans = previous.getBeansOfName(name); +// +// result = calculateBeansDiff(previousBeans, currentBeans, result); +// } +// +// return result; +// } +// +// private Change calculateBeansDiff(List previousBeans, List currentBeans, Change result) { +// if (currentBeans == null) currentBeans = EMPTY_BEANS_LIST; +// if (previousBeans == null) previousBeans = EMPTY_BEANS_LIST; +// +// for (LiveBean bean : previousBeans) { +// if (!contains(currentBeans, bean)) { +// +// if (result == null) { +// result = new Change(associatedProcess); +// } +// +// result.addDeletedBean(bean); +// } +// } +// +// for (LiveBean bean : currentBeans) { +// if (!contains(previousBeans, bean)) { +// +// if (result == null) { +// result = new Change(associatedProcess); +// } +// +// result.addNewBean(bean); +// } +// } +// +// return result; +// } +// +// private boolean contains(List beans, LiveBean bean) { +// for (LiveBean beansFromList : beans) { +// if (StringUtils.equals(beansFromList.getId(), bean.getId()) +// && StringUtils.equals(beansFromList.getType(true), bean.getType(true)) +// && StringUtils.equals(beansFromList.getResource(), bean.getResource())) { +// return true; +// } +// } +// +// return false; +// } } diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/SpringLiveChangeDetectionWatchdog.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/SpringLiveChangeDetectionWatchdog.java index e11581ac2..7d94d891d 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/SpringLiveChangeDetectionWatchdog.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/SpringLiveChangeDetectionWatchdog.java @@ -10,35 +10,16 @@ *******************************************************************************/ package org.springframework.ide.vscode.boot.java.utils; -import java.io.File; -import java.nio.file.Path; -import java.nio.file.Paths; import java.time.Duration; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; -import java.util.Map; import java.util.Set; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.eclipse.lsp4j.Diagnostic; -import org.eclipse.lsp4j.DiagnosticSeverity; -import org.eclipse.lsp4j.Position; -import org.eclipse.lsp4j.PublishDiagnosticsParams; -import org.eclipse.lsp4j.Range; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppMatcher; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; import org.springframework.ide.vscode.boot.java.links.SourceLinks; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBean; -import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp; import org.springframework.ide.vscode.commons.java.IJavaProject; import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder; import org.springframework.ide.vscode.commons.languageserver.java.ProjectObserver; @@ -57,7 +38,6 @@ public class SpringLiveChangeDetectionWatchdog { private final long POLLING_INTERVAL_MILLISECONDS; private final SimpleLanguageServer server; - private final RunningAppProvider runningAppProvider; private final SourceLinks sourceLinks; private final ChangeDetectionHistory changeHistory; @@ -70,7 +50,6 @@ public class SpringLiveChangeDetectionWatchdog { BootJavaLanguageServerComponents bootJavaLanguageServerComponents, SimpleLanguageServer server, ProjectObserver projectObserver, - RunningAppProvider runningAppProvider, JavaProjectFinder projectFinder, Duration pollingInterval, SourceLinks sourceLinks @@ -78,7 +57,6 @@ public class SpringLiveChangeDetectionWatchdog { this.observedProjects = new HashSet<>(); this.server = server; - this.runningAppProvider = runningAppProvider; this.POLLING_INTERVAL_MILLISECONDS = pollingInterval == null ? DEFAULT_INTERVAL.toMillis() : pollingInterval.toMillis(); @@ -124,142 +102,139 @@ public class SpringLiveChangeDetectionWatchdog { public void update() { if (changeDetectionEnabled) { - try { - SpringBootApp[] runningBootApps = runningAppProvider.getAllRunningSpringApps().toArray(new SpringBootApp[0]); - Change[] changes = changeHistory.checkForChanges(runningBootApps); - if (changes != null && changes.length > 0) { - for (Change change : changes) { - publishDetectedChange(change); - } - } - for (SpringBootApp app : runningBootApps) { - updateApp(app); - } - } catch (Exception e) { - logger.error("", e); - } +// try { +// SpringBootApp[] runningBootApps = runningAppProvider.getAllRunningSpringApps().toArray(new SpringBootApp[0]); +// Change[] changes = changeHistory.checkForChanges(runningBootApps); +// if (changes != null && changes.length > 0) { +// for (Change change : changes) { +// publishDetectedChange(change); +// } +// } +// for (SpringBootApp app : runningBootApps) { +// updateApp(app); +// } +// } catch (Exception e) { +// logger.error("", e); +// } } } - private void updateApp(SpringBootApp app) { - } - private void publishDetectedChange(Change change) { - Map> diagnostics = new HashMap<>(); - - IJavaProject[] projects = findProjectsFor(change.getRunningApp()); - - List deletedBeans = change.getDeletedBeans(); - if (deletedBeans != null) { - for (LiveBean liveBean : deletedBeans) { - Diagnostic diag = new Diagnostic(); - diag.setSeverity(DiagnosticSeverity.Information); - diag.setRange(new Range(new Position(0, 0), new Position(0, 0))); - diag.setSource("Spring Boot Change Detection Mechanism"); - - diag.setMessage("bean removed from app: " + liveBean.getId()); - - String docURI = getDocURI(liveBean, projects); - if (docURI != null) { - List diags = diagnostics.computeIfAbsent(docURI, (s) -> new ArrayList<>()); - diags.add(diag); - } - else { - logger.info("deleted bean could not be associated with a doc URI: " + liveBean.getId()); - } - } - } - - List newBeans = change.getNewBeans(); - if (newBeans != null) { - for (LiveBean liveBean : newBeans) { - Diagnostic diag = new Diagnostic(); - diag.setSeverity(DiagnosticSeverity.Information); - diag.setRange(new Range(new Position(0, 0), new Position(0, 0))); - diag.setSource("Spring Boot Change Detection Mechanism"); - - diag.setMessage("new bean detected: " + liveBean.getId()); - - String docURI = getDocURI(liveBean, projects); - if (docURI != null) { - List diags = diagnostics.computeIfAbsent(docURI, (s) -> new ArrayList<>()); - diags.add(diag); - } - else { - logger.info("new bean could not be associated with a doc URI: " + liveBean.getId()); - } - } - } - - for (String docURI : diagnostics.keySet()) { - PublishDiagnosticsParams params = new PublishDiagnosticsParams(docURI, diagnostics.get(docURI)); - server.getClient().publishDiagnostics(params); - } +// Map> diagnostics = new HashMap<>(); +// +// IJavaProject[] projects = findProjectsFor(change.getRunningApp()); +// +// List deletedBeans = change.getDeletedBeans(); +// if (deletedBeans != null) { +// for (LiveBean liveBean : deletedBeans) { +// Diagnostic diag = new Diagnostic(); +// diag.setSeverity(DiagnosticSeverity.Information); +// diag.setRange(new Range(new Position(0, 0), new Position(0, 0))); +// diag.setSource("Spring Boot Change Detection Mechanism"); +// +// diag.setMessage("bean removed from app: " + liveBean.getId()); +// +// String docURI = getDocURI(liveBean, projects); +// if (docURI != null) { +// List diags = diagnostics.computeIfAbsent(docURI, (s) -> new ArrayList<>()); +// diags.add(diag); +// } +// else { +// logger.info("deleted bean could not be associated with a doc URI: " + liveBean.getId()); +// } +// } +// } +// +// List newBeans = change.getNewBeans(); +// if (newBeans != null) { +// for (LiveBean liveBean : newBeans) { +// Diagnostic diag = new Diagnostic(); +// diag.setSeverity(DiagnosticSeverity.Information); +// diag.setRange(new Range(new Position(0, 0), new Position(0, 0))); +// diag.setSource("Spring Boot Change Detection Mechanism"); +// +// diag.setMessage("new bean detected: " + liveBean.getId()); +// +// String docURI = getDocURI(liveBean, projects); +// if (docURI != null) { +// List diags = diagnostics.computeIfAbsent(docURI, (s) -> new ArrayList<>()); +// diags.add(diag); +// } +// else { +// logger.info("new bean could not be associated with a doc URI: " + liveBean.getId()); +// } +// } +// } +// +// for (String docURI : diagnostics.keySet()) { +// PublishDiagnosticsParams params = new PublishDiagnosticsParams(docURI, diagnostics.get(docURI)); +// server.getClient().publishDiagnostics(params); +// } } - private IJavaProject[] findProjectsFor(SpringBootApp app) { - List result = new ArrayList<>(); - - try { - Set runningClasspath = new HashSet<>(); - Collections.addAll(runningClasspath, app.getClasspath()); - - for (IJavaProject project : this.observedProjects) { - if (RunningAppMatcher.doesClasspathMatch(runningClasspath, project)) { - result.add(project); - break; - } - } - } - catch (Exception e) { - logger.error("find projects failed with: ", e); - } - - return (IJavaProject[]) result.toArray(new IJavaProject[result.size()]); - } - - private String getDocURI(LiveBean liveBean, IJavaProject[] projects) { - String result = null; - - String resource = liveBean.getResource(); - if (resource != null) { - - Pattern BRACKETS = Pattern.compile("\\[[^\\]]*\\]"); - - Matcher matcher = BRACKETS.matcher(resource); - if (matcher.find()) { - String type = resource.substring(0, matcher.start()).trim(); - String path = resource.substring(matcher.start()+1, matcher.end()-1); - - for (IJavaProject project : projects) { - if (SpringResource.FILE.equals(type) || SpringResource.URL.equals(type)) { - result = sourceLinks.sourceLinkUrlForClasspathResource(path).get(); - if (result == null) { - result = sourceLinks.sourceLinkForResourcePath(Paths.get(path)).get(); - } - break; - } - else if (SpringResource.CLASS_PATH_RESOURCE.equals(type)) { - int idx = path.lastIndexOf(SourceLinks.CLASS); - if (idx >= 0) { - Path p = Paths.get(path.substring(0, idx)); - result = sourceLinks.sourceLinkUrlForFQName(project, p.toString().replace(File.separator, ".")).get(); - } - break; - } - } - } - - if (result != null) { - int position = result.lastIndexOf('#'); - if (position > 0) { - result = result.substring(0, position); - } - } - } - return result; - } +// private IJavaProject[] findProjectsFor(SpringBootApp app) { +// List result = new ArrayList<>(); +// +// try { +// Set runningClasspath = new HashSet<>(); +// Collections.addAll(runningClasspath, app.getClasspath()); +// +// for (IJavaProject project : this.observedProjects) { +// if (RunningAppMatcher.doesClasspathMatch(runningClasspath, project)) { +// result.add(project); +// break; +// } +// } +// } +// catch (Exception e) { +// logger.error("find projects failed with: ", e); +// } +// +// return (IJavaProject[]) result.toArray(new IJavaProject[result.size()]); +// } +// +// private String getDocURI(LiveBean liveBean, IJavaProject[] projects) { +// String result = null; +// +// String resource = liveBean.getResource(); +// if (resource != null) { +// +// Pattern BRACKETS = Pattern.compile("\\[[^\\]]*\\]"); +// +// Matcher matcher = BRACKETS.matcher(resource); +// if (matcher.find()) { +// String type = resource.substring(0, matcher.start()).trim(); +// String path = resource.substring(matcher.start()+1, matcher.end()-1); +// +// for (IJavaProject project : projects) { +// if (SpringResource.FILE.equals(type) || SpringResource.URL.equals(type)) { +// result = sourceLinks.sourceLinkUrlForClasspathResource(path).get(); +// if (result == null) { +// result = sourceLinks.sourceLinkForResourcePath(Paths.get(path)).get(); +// } +// break; +// } +// else if (SpringResource.CLASS_PATH_RESOURCE.equals(type)) { +// int idx = path.lastIndexOf(SourceLinks.CLASS); +// if (idx >= 0) { +// Path p = Paths.get(path.substring(0, idx)); +// result = sourceLinks.sourceLinkUrlForFQName(project, p.toString().replace(File.separator, ".")).get(); +// } +// break; +// } +// } +// } +// +// if (result != null) { +// int position = result.lastIndexOf('#'); +// if (position > 0) { +// result = result.substring(0, position); +// } +// } +// } +// return result; +// } public synchronized void enableHighlights() { if (!changeDetectionEnabled) { diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/SpringLiveHoverWatchdog.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/SpringLiveHoverWatchdog.java deleted file mode 100644 index 54c06a8dc..000000000 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/utils/SpringLiveHoverWatchdog.java +++ /dev/null @@ -1,274 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017, 2019 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.vscode.boot.java.utils; - -import java.time.Duration; -import java.util.Arrays; -import java.util.Collection; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.eclipse.lsp4j.CodeLens; -import org.eclipse.lsp4j.TextDocumentIdentifier; -import org.eclipse.lsp4j.VersionedTextDocumentIdentifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.ide.vscode.boot.java.handlers.BootJavaHoverProvider; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppMatcher; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; -import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; -import org.springframework.ide.vscode.commons.boot.app.cli.SpringBootApp; -import org.springframework.ide.vscode.commons.java.IJavaProject; -import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder; -import org.springframework.ide.vscode.commons.languageserver.java.ProjectObserver; -import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer; -import org.springframework.ide.vscode.commons.protocol.HighlightParams; -import org.springframework.ide.vscode.commons.util.MemoizingProxy; -import org.springframework.ide.vscode.commons.util.text.TextDocument; - -/** - * @author Martin Lippert - */ -public class SpringLiveHoverWatchdog { - - public static final Duration DEFAULT_INTERVAL = Duration.ofMillis(5000); - - Logger logger = LoggerFactory.getLogger(SpringLiveHoverWatchdog.class); - - private final long POLLING_INTERVAL_MILLISECONDS; - - private final SimpleLanguageServer server; - private final BootJavaHoverProvider hoverProvider; - private final RunningAppProvider runningAppProvider; - - private boolean highlightsEnabled = true; - private ScheduledThreadPoolExecutor timer; - private JavaProjectFinder projectFinder; - private final Map> watchedDocs; - - public SpringLiveHoverWatchdog( - SimpleLanguageServer server, - BootJavaHoverProvider hoverProvider, - JavaProjectFinder projectFinder, - ProjectObserver projectChanges, - Duration pollingInterval) { - - this.POLLING_INTERVAL_MILLISECONDS = pollingInterval == null ? DEFAULT_INTERVAL.toMillis() : pollingInterval.toMillis(); - this.server = server; - this.hoverProvider = hoverProvider; - this.runningAppProvider = runningAppProvider; - this.projectFinder = projectFinder; - this.watchedDocs = new ConcurrentHashMap<>(); - - projectChanges.addListener(new ProjectObserver.Listener() { - - @Override - public void deleted(IJavaProject project) { - logger.info("project deleted event: {}", project.getElementName()); - refreshEnablement(); - } - - @Override - public void created(IJavaProject project) { - logger.info("project created event: {}", project.getElementName()); - refreshEnablement(); - } - - @Override - public void changed(IJavaProject project) { - logger.info("project changed event: {}", project.getElementName()); - refreshEnablement(); - } - }); - } - - public synchronized void enableHighlights() { - if (!highlightsEnabled) { - highlightsEnabled = true; - refreshEnablement(); - } - } - - public synchronized void disableHighlights() { - if (highlightsEnabled) { - highlightsEnabled = false; - refreshEnablement(); - } - } - - private synchronized void start() { - if (highlightsEnabled && timer == null) { - logger.info("Starting SpringLiveHoverWatchdog"); - this.timer = new ScheduledThreadPoolExecutor(1); - this.timer.scheduleWithFixedDelay(() -> this.update(), 0, POLLING_INTERVAL_MILLISECONDS, TimeUnit.MILLISECONDS); - } - } - - public synchronized void shutdown() { - if (timer != null) { - logger.info("Shutting down SpringLiveHoverWatchdog"); - timer.shutdown(); - timer = null; - watchedDocs.keySet().forEach(uri -> cleanupLiveHints(uri)); - } - } - - public synchronized void watchDocument(String docURI) { - this.watchedDocs.putIfAbsent(docURI, new AtomicReference()); - refreshEnablement(); - } - - public synchronized void unwatchDocument(String docURI) { - this.watchedDocs.remove(docURI); - cleanupLiveHints(docURI); - - if (watchedDocs.size() == 0) { - cleanupResources(); - } - refreshEnablement(); - } - - public void update(String docURI) { - ScheduledThreadPoolExecutor scheduler = this.timer; - if (scheduler != null) { - scheduler.execute(() -> { - updateDoc(docURI); - }); - } - } - - // internal method, need to run on the scheduled executor pool, do not call outside of that - protected void updateDoc(String docURI) { - try { - IJavaProject project = getCachedProject(docURI); - SpringBootApp[] runningBootApps = RunningAppMatcher.getAllMatchingApps(runningAppProvider.getAllRunningSpringApps(), project).toArray(new SpringBootApp[0]); - update(docURI, project, runningBootApps); - } - catch (Exception e) { - logger.error("", e); - } - } - - // internal method, need to run on the scheduled executor pool, do not call outside of that - protected void update() { - if (this.watchedDocs.size() > 0) { - try { - Collection runningBootApps = runningAppProvider.getAllRunningSpringApps(); - Collection cachedApps = createAppCaches(runningBootApps); - - for (String docURI : watchedDocs.keySet()) { - IJavaProject project = getCachedProject(docURI); - SpringBootApp[] matchingApps = RunningAppMatcher.getAllMatchingApps(cachedApps, project).toArray(new SpringBootApp[0]); - update(docURI, project, matchingApps); - } - } catch (Exception e) { - logger.error("", e); - } - } - } - - // internal method, need to run on the scheduled executor pool, do not call outside of that - protected void update(String docURI, IJavaProject project, SpringBootApp[] runningBootApps) { - if (highlightsEnabled) { - try { - boolean hasCurrentRunningBootApps = runningBootApps != null && runningBootApps.length > 0; - if (hasCurrentRunningBootApps) { - TextDocument doc = this.server.getTextDocumentService().get(docURI); - if (doc != null) { - CodeLens[] infos = this.hoverProvider.getLiveHoverHints(doc, project); - publishLiveHints(docURI, infos); - } - } - else { - cleanupLiveHints(docURI); - } - } catch (Exception e) { - logger.error("", e); - } - } - } - - private final MemoizingProxy.Builder memoizingProxyBuilder = MemoizingProxy.builder(SpringBootApp.class, Duration.ofMillis(20000)); - - private Collection createAppCaches(Collection runningBootApps) { - return runningBootApps.stream().map(app -> { - SpringBootApp proxied = memoizingProxyBuilder.delegateTo(app); - try { - proxied.getProcessName(); - proxied.getProcessID(); - } - catch (Exception e) { - } - return proxied; - }).filter(app -> app != null).collect(Collectors.toList()); - } - - private void refreshEnablement() { - boolean shouldEnable = highlightsEnabled && hasInterestingProject(watchedDocs.keySet().stream()); - if (shouldEnable) { - start(); - } else { - shutdown(); - } - } - - private boolean hasInterestingProject(Stream uris) { - return uris.anyMatch(uri -> projectFinder.find(new TextDocumentIdentifier(uri)).isPresent()); - } - - private IJavaProject getCachedProject(String docURI) { - AtomicReference reference = this.watchedDocs.get(docURI); - if (reference != null) { - IJavaProject project = reference.get(); - if (project == null) { - project = identifyProject(docURI); - if (!reference.compareAndSet(null, project)) { - return reference.get(); - } - } - return project; - } - return null; - } - - private IJavaProject identifyProject(String docURI) { - TextDocument doc = this.server.getTextDocumentService().get(docURI); - if (doc != null) { - return projectFinder.find(doc.getId()).orElse(null); - } - else { - return null; - } - } - - private void publishLiveHints(String docURI, CodeLens[] codeLenses) { - TextDocument doc = server.getTextDocumentService().get(docURI); - if (doc != null) { - int version = doc.getVersion(); - VersionedTextDocumentIdentifier id = new VersionedTextDocumentIdentifier(docURI, version); - server.getClient().highlight(new HighlightParams(id, Arrays.asList(codeLenses))); - } - } - - private void cleanupLiveHints(String docURI) { - publishLiveHints(docURI, new CodeLens[0]); - } - - private void cleanupResources() { - // TODO: close and cleanup open JMX connections and cached data - } - -} diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/HoverTestConf.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/HoverTestConf.java index 0e39bf8d8..74fc5d9ee 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/HoverTestConf.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/HoverTestConf.java @@ -10,14 +10,11 @@ *******************************************************************************/ package org.springframework.ide.vscode.boot.bootiful; -import java.time.Duration; - import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.ide.vscode.boot.app.BootLanguageServerParams; import org.springframework.ide.vscode.boot.editor.harness.PropertyIndexHarness; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; import org.springframework.ide.vscode.boot.java.links.SourceLinkFactory; import org.springframework.ide.vscode.boot.java.links.SourceLinks; import org.springframework.ide.vscode.boot.java.utils.SymbolCache; @@ -27,7 +24,6 @@ import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFin import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer; import org.springframework.ide.vscode.commons.util.text.LanguageId; import org.springframework.ide.vscode.project.harness.BootLanguageServerHarness; -import org.springframework.ide.vscode.project.harness.MockRunningAppProvider; @Configuration @Import(AdHocPropertyHarnessTestConf.class) @@ -41,30 +37,17 @@ public class HoverTestConf { return new PropertyIndexHarness(valueProviders); } - @Bean MockRunningAppProvider mockAppsHarness() { - return new MockRunningAppProvider(); - } - - @Bean RunningAppProvider runningAppProvider(MockRunningAppProvider mockApps) { - return mockApps.provider; - } - @Bean BootLanguageServerHarness harness(SimpleLanguageServer server, BootLanguageServerParams serverParams, PropertyIndexHarness indexHarness, JavaProjectFinder projectFinder) throws Exception { return new BootLanguageServerHarness(server, serverParams, indexHarness, projectFinder, LanguageId.JAVA, ".java"); } - @Bean Duration watchDogInterval() { - return Duration.ofMillis(100); - } - @Bean BootLanguageServerParams serverParams(SimpleLanguageServer server, ValueProviderRegistry valueProviders, PropertyIndexHarness indexHarness) { BootLanguageServerParams testDefaults = BootLanguageServerParams.createTestDefault(server, valueProviders); return new BootLanguageServerParams( indexHarness.getProjectFinder(), testDefaults.projectObserver, indexHarness.getIndexProvider(), - testDefaults.typeUtilProvider, - watchDogInterval() + testDefaults.typeUtilProvider ); } diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/PropertyEditorTestConf.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/PropertyEditorTestConf.java index dc180e9ac..11b524a28 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/PropertyEditorTestConf.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/PropertyEditorTestConf.java @@ -17,12 +17,10 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.ide.vscode.boot.app.BootLanguageServerParams; import org.springframework.ide.vscode.boot.editor.harness.PropertyIndexHarness; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; import org.springframework.ide.vscode.boot.java.links.JavaDocumentUriProvider; import org.springframework.ide.vscode.boot.java.links.SourceLinkFactory; import org.springframework.ide.vscode.boot.java.links.SourceLinks; import org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache; -import org.springframework.ide.vscode.boot.java.utils.SpringLiveHoverWatchdog; import org.springframework.ide.vscode.boot.java.utils.SymbolCache; import org.springframework.ide.vscode.boot.java.utils.SymbolCacheVoid; import org.springframework.ide.vscode.boot.metadata.ValueProviderRegistry; @@ -35,7 +33,6 @@ import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguage import org.springframework.ide.vscode.commons.util.text.IDocument; import org.springframework.ide.vscode.commons.util.text.LanguageId; import org.springframework.ide.vscode.project.harness.BootLanguageServerHarness; -import org.springframework.ide.vscode.project.harness.MockRunningAppProvider; @Configuration @Import(AdHocPropertyHarnessTestConf.class) @@ -49,14 +46,6 @@ public class PropertyEditorTestConf { return new PropertyIndexHarness(valueProviders); } - @Bean MockRunningAppProvider mockAppsHarness() { - return new MockRunningAppProvider(); - } - - @Bean RunningAppProvider runningAppProvider(MockRunningAppProvider mockApps) { - return mockApps.provider; - } - @Bean BootLanguageServerHarness harness( SimpleLanguageServer server, BootLanguageServerParams serverParams, @@ -76,8 +65,7 @@ public class PropertyEditorTestConf { projectFinder, ProjectObserver.NULL, indexHarness.getIndexProvider(), - typeUtilProvider, - SpringLiveHoverWatchdog.DEFAULT_INTERVAL + typeUtilProvider ); } diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/SourceLinksTestConf.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/SourceLinksTestConf.java index 4fd81b2aa..18a202268 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/SourceLinksTestConf.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/SourceLinksTestConf.java @@ -15,7 +15,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.ide.vscode.boot.app.BootLanguageServerParams; import org.springframework.ide.vscode.boot.editor.harness.PropertyIndexHarness; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; import org.springframework.ide.vscode.boot.java.links.SourceLinks; import org.springframework.ide.vscode.boot.java.links.VSCodeSourceLinks; import org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache; @@ -58,8 +57,7 @@ public class SourceLinksTestConf { testDefaults.projectFinder, new MockProjectObserver(), testDefaults.indexProvider, - testDefaults.typeUtilProvider, - testDefaults.watchDogInterval + testDefaults.typeUtilProvider ); } @@ -71,10 +69,6 @@ public class SourceLinksTestConf { return new VSCodeSourceLinks(cuCache, projectFinder); } - @Bean RunningAppProvider runningAppProvider() { - return RunningAppProvider.NULL; - } - @Bean MockProjectObserver mockProjectObserver(BootLanguageServerParams params) { return (MockProjectObserver) params.projectObserver; } diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/SymbolProviderTestConf.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/SymbolProviderTestConf.java index b0e4805d4..201fe3b28 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/SymbolProviderTestConf.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/SymbolProviderTestConf.java @@ -15,7 +15,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.ide.vscode.boot.app.BootLanguageServerParams; import org.springframework.ide.vscode.boot.editor.harness.PropertyIndexHarness; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; import org.springframework.ide.vscode.boot.java.links.SourceLinkFactory; import org.springframework.ide.vscode.boot.java.links.SourceLinks; import org.springframework.ide.vscode.boot.java.utils.SymbolCache; @@ -59,7 +58,4 @@ public class SymbolProviderTestConf { return SourceLinkFactory.NO_SOURCE_LINKS; } - @Bean RunningAppProvider runningAppProvider() { - return RunningAppProvider.NULL; - } } \ No newline at end of file diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/XmlBeansTestConf.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/XmlBeansTestConf.java index fcb31bf89..065f594df 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/XmlBeansTestConf.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/bootiful/XmlBeansTestConf.java @@ -15,7 +15,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import org.springframework.ide.vscode.boot.app.BootLanguageServerParams; import org.springframework.ide.vscode.boot.editor.harness.PropertyIndexHarness; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; import org.springframework.ide.vscode.boot.java.links.JavaDocumentUriProvider; import org.springframework.ide.vscode.boot.java.links.SourceLinkFactory; import org.springframework.ide.vscode.boot.java.links.SourceLinks; @@ -57,8 +56,7 @@ public class XmlBeansTestConf { indexHarness.getProjectFinder(), new MockProjectObserver(), testDefaults.indexProvider, - testDefaults.typeUtilProvider, - testDefaults.watchDogInterval + testDefaults.typeUtilProvider ); } @@ -74,10 +72,6 @@ public class XmlBeansTestConf { return SourceLinkFactory.NO_SOURCE_LINKS; } - @Bean RunningAppProvider runningAppProvider() { - return RunningAppProvider.NULL; - } - @Bean MockProjectObserver mockProjectObserver(BootLanguageServerParams params) { return (MockProjectObserver) params.projectObserver; } diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/autowired/test/AutowiredHoverProviderTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/autowired/test/AutowiredHoverProviderTest.java index 52dd02b27..9f7ca2d5e 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/autowired/test/AutowiredHoverProviderTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/autowired/test/AutowiredHoverProviderTest.java @@ -16,6 +16,7 @@ import java.nio.file.Paths; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -25,14 +26,16 @@ import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest; import org.springframework.ide.vscode.boot.bootiful.HoverTestConf; import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBean; import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBeansModel; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveData; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject; 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.ide.vscode.project.harness.ProjectsHarness.CustomizableProjectContent; import org.springframework.ide.vscode.project.harness.ProjectsHarness.ProjectCustomizer; +import org.springframework.ide.vscode.project.harness.SpringProcessLiveDataBuilder; import org.springframework.test.context.junit4.SpringRunner; /** @@ -132,13 +135,11 @@ public class AutowiredHoverProviderTest { p.createType("com.example.FooImplementation", FOO_IMPL_CONTENTS); }; - @Autowired - private BootLanguageServerHarness harness; + @Autowired private BootLanguageServerHarness harness; + @Autowired private SpringProcessLiveDataProvider liveDataProvider; + private ProjectsHarness projects = ProjectsHarness.INSTANCE; - @Autowired - private MockRunningAppProvider mockAppProvider; - @Before public void setup() throws Exception { MavenJavaProject jp = projects.mavenProject("empty-boot-15-web-app", FOO_INTERFACE); @@ -146,6 +147,11 @@ public class AutowiredHoverProviderTest { harness.useProject(jp); harness.intialize(null); } + + @After + public void tearDown() throws Exception { + liveDataProvider.remove("processkey"); + } @Test public void javaxInjectAnnotationHover() throws Exception { @@ -163,13 +169,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); - + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -218,13 +225,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); - + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -292,13 +300,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("unrelated-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("unrelated-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -337,13 +346,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -383,13 +393,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, FOO_IMPL_CONTENTS); editor.assertHighlights("@Component", "@Autowired", "@Autowired"); @@ -418,13 +429,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -482,13 +494,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -560,13 +573,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -609,13 +623,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -663,13 +678,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -718,13 +734,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -792,13 +809,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -845,13 +863,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -891,13 +910,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -937,13 +957,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -989,13 +1010,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -1043,13 +1065,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -1090,13 +1113,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -1137,13 +1161,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -1190,13 +1215,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -1246,13 +1272,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -1299,13 +1326,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + @@ -1343,13 +1371,14 @@ public class AutowiredHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") - .processName("the-app") - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") + .processName("the-app") + .beans(beans) + .build(); + liveDataProvider.add("processkey", liveData); + Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + "\n" + diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/conditionals/test/ConditionalsLiveHoverTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/conditionals/test/ConditionalsLiveHoverTest.java index 9cc181002..e293022a1 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/conditionals/test/ConditionalsLiveHoverTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/conditionals/test/ConditionalsLiveHoverTest.java @@ -11,11 +11,11 @@ package org.springframework.ide.vscode.boot.java.conditionals.test; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; import java.io.File; import org.eclipse.lsp4j.Hover; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -23,11 +23,13 @@ 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.boot.java.livehover.v2.SpringProcessLiveData; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; 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.ide.vscode.project.harness.SpringProcessLiveDataBuilder; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @@ -35,16 +37,21 @@ import org.springframework.test.context.junit4.SpringRunner; @Import(HoverTestConf.class) public class ConditionalsLiveHoverTest { - @Autowired - private BootLanguageServerHarness harness; - - @Autowired - private MockRunningAppProvider mockAppProvider; + @Autowired private BootLanguageServerHarness harness; + @Autowired private SpringProcessLiveDataProvider liveDataProvider; @Before public void setup() throws Exception { harness.useProject(ProjectsHarness.INSTANCE.mavenProject("test-conditionals-live-hover")); } + + @After + public void tearDown() throws Exception { + liveDataProvider.remove("processkey"); + liveDataProvider.remove("processkey1"); + liveDataProvider.remove("processkey2"); + liveDataProvider.remove("processkey3"); + } @Test public void testNoLiveHoverNoRunningApp() throws Exception { @@ -56,9 +63,6 @@ public class ConditionalsLiveHoverTest { harness.intialize(directory); - assertTrue("Expected no mock running boot apps, but found: " + mockAppProvider.mockedApps, - mockAppProvider.mockedApps.isEmpty()); - Editor editor = harness.newEditorFromFileUri(docUri, LanguageId.JAVA); editor.assertNoHover("@ConditionalOnMissingBean"); } @@ -72,11 +76,15 @@ public class ConditionalsLiveHoverTest { .toString(); // Build a mock running boot app - mockAppProvider.builder().isSpringBootApp(true).port("1111").processId("22022").host("cfapps.io") + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .port("1111") + .processID("22022") + .host("cfapps.io") .processName("test-conditionals-live-hover") .liveConditionalsJson( "{\"positiveMatches\":{\"ConditionalOnBeanConfig#hi\":[{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnBean (types: example.Hello; SearchStrategy: all) found bean 'missing'\"}]}}") .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -95,11 +103,15 @@ public class ConditionalsLiveHoverTest { .toString(); // Build a mock running boot app - mockAppProvider.builder().isSpringBootApp(true).port("1111").processId("22022").host("cfapps.io") + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .port("1111") + .processID("22022") + .host("cfapps.io") .processName("test-conditionals-live-hover") .liveConditionalsJson( "{\"positiveMatches\":{\"ConditionalOnMissingBeanConfig#missing\":[{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnMissingBean (types: example.Hello; SearchStrategy: all) did not find any beans\"}]}}") .build(); + liveDataProvider.add("proesskey", liveData); harness.intialize(directory); @@ -119,11 +131,15 @@ public class ConditionalsLiveHoverTest { .toString(); // Build a mock running boot app - mockAppProvider.builder().isSpringBootApp(true).port("1111").processId("22022").host("cfapps.io") + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .port("1111") + .processID("22022") + .host("cfapps.io") .processName("test-conditionals-live-hover") .liveConditionalsJson( "{\"positiveMatches\":{\"HelloConfig#missing\":[{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnMissingBean (types: example.Hello; SearchStrategy: all) did not find any beans\"}],\"HelloConfig2#hi\":[{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnBean (types: example.Hello; SearchStrategy: all) found bean 'missing'\"}],\"MultipleConditionals#hi\":[{\"condition\":\"OnClassCondition\",\"message\":\"@ConditionalOnClass found required class; @ConditionalOnMissingClass did not find unwanted class\"},{\"condition\":\"OnWebApplicationCondition\",\"message\":\"@ConditionalOnWebApplication (required) found StandardServletEnvironment\"},{\"condition\":\"OnJavaCondition\",\"message\":\"@ConditionalOnJava (1.8 or newer) found 1.8\"},{\"condition\":\"OnExpressionCondition\",\"message\":\"@ConditionalOnExpression (#{true}) resulted in true\"},{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnBean (types: example.Hello; SearchStrategy: all) found beans 'hi', 'missing'\"}]}}") .build(); + liveDataProvider.add("proesskey", liveData); harness.intialize(directory); @@ -159,23 +175,35 @@ public class ConditionalsLiveHoverTest { .toString(); // Build a mock running boot app - mockAppProvider.builder().isSpringBootApp(true).port("1000").processId("70000").host("cfapps.io") + SpringProcessLiveData liveData1 = new SpringProcessLiveDataBuilder() + .port("1000") + .processID("70000") + .host("cfapps.io") .processName("test-conditionals-live-hover") .liveConditionalsJson( "{\"positiveMatches\":{\"ConditionalOnMissingBeanConfig#missing\":[{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnMissingBean (types: example.Hello; SearchStrategy: all) did not find any beans\"}]}}") .build(); + liveDataProvider.add("processkey1", liveData1); - mockAppProvider.builder().isSpringBootApp(true).port("1001").processId("80000").host("cfapps.io") + SpringProcessLiveData liveData2 = new SpringProcessLiveDataBuilder() + .port("1001") + .processID("80000") + .host("cfapps.io") .processName("test-conditionals-live-hover") .liveConditionalsJson( "{\"positiveMatches\":{\"ConditionalOnMissingBeanConfig#missing\":[{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnMissingBean (types: example.Hello; SearchStrategy: all) did not find any beans\"}]}}") .build(); + liveDataProvider.add("processkey2", liveData2); - mockAppProvider.builder().isSpringBootApp(true).port("1002").processId("90000").host("cfapps.io") + SpringProcessLiveData liveData3 = new SpringProcessLiveDataBuilder() + .port("1002") + .processID("90000") + .host("cfapps.io") .processName("test-conditionals-live-hover") .liveConditionalsJson( "{\"positiveMatches\":{\"ConditionalOnMissingBeanConfig#missing\":[{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnMissingBean (types: example.Hello; SearchStrategy: all) did not find any beans\"}]}}") .build(); + liveDataProvider.add("processkey3", liveData3); harness.intialize(directory); @@ -211,11 +239,15 @@ public class ConditionalsLiveHoverTest { .toString(); // Build a mock running boot app - mockAppProvider.builder().isSpringBootApp(true).port("1000").processId("70000").host("cfapps.io") + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .port("1000") + .processID("70000") + .host("cfapps.io") .processName("test-conditionals-live-hover") .liveConditionalsJson( "{\"positiveMatches\":{\"HelloConfig#missing\":[{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnMissingBean (types: example.Hello; SearchStrategy: all) did not find any beans\"}],\"HelloConfig2#hi\":[{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnBean (types: example.Hello; SearchStrategy: all) found bean 'missing'\"}],\"MultipleConditionals#hi\":[{\"condition\":\"OnClassCondition\",\"message\":\"@ConditionalOnClass found required class; @ConditionalOnMissingClass did not find unwanted class\"},{\"condition\":\"OnWebApplicationCondition\",\"message\":\"@ConditionalOnWebApplication (required) found StandardServletEnvironment\"},{\"condition\":\"OnJavaCondition\",\"message\":\"@ConditionalOnJava (1.8 or newer) found 1.8\"},{\"condition\":\"OnExpressionCondition\",\"message\":\"@ConditionalOnExpression (#{true}) resulted in true\"},{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnBean (types: example.Hello; SearchStrategy: all) found beans 'hi', 'missing'\"}]}}") .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -259,11 +291,15 @@ public class ConditionalsLiveHoverTest { .toString(); // Build a mock running boot app - mockAppProvider.builder().isSpringBootApp(true).port("1000").processId("70000").host("cfapps.io") + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .port("1000") + .processID("70000") + .host("cfapps.io") .processName("test-conditionals-live-hover") .liveConditionalsJson( "{\"positiveMatches\":{\"MultipleConditionalsPT152535713#hi\":[{\"condition\":\"OnWebApplicationCondition\",\"message\":\"@ConditionalOnWebApplication (required) found StandardServletEnvironment\"},{\"condition\":\"OnJavaCondition\",\"message\":\"@ConditionalOnJava (1.8 or newer) found 1.8\"}]}}") .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -296,11 +332,15 @@ public class ConditionalsLiveHoverTest { .toString(); // Build a mock running boot app - mockAppProvider.builder().isSpringBootApp(true).port("1111").processId("22022").host("cfapps.io") + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .port("1111") + .processID("22022") + .host("cfapps.io") .processName("test-conditionals-live-hover") .liveConditionalsJson( "{\"positiveMatches\":{\"HelloConfig#missing\":[{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnMissingBean (types: example.Hello; SearchStrategy: all) did not find any beans\"}],\"HelloConfig2#hi\":[{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnBean (types: example.Hello; SearchStrategy: all) found bean 'missing'\"}],\"MultipleConditionals#hi\":[{\"condition\":\"OnClassCondition\",\"message\":\"@ConditionalOnClass found required class; @ConditionalOnMissingClass did not find unwanted class\"},{\"condition\":\"OnWebApplicationCondition\",\"message\":\"@ConditionalOnWebApplication (required) found StandardServletEnvironment\"},{\"condition\":\"OnJavaCondition\",\"message\":\"@ConditionalOnJava (1.8 or newer) found 1.8\"},{\"condition\":\"OnExpressionCondition\",\"message\":\"@ConditionalOnExpression (#{true}) resulted in true\"},{\"condition\":\"OnBeanCondition\",\"message\":\"@ConditionalOnBean (types: example.Hello; SearchStrategy: all) found beans 'hi', 'missing'\"}]}}") .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -336,7 +376,10 @@ public class ConditionalsLiveHoverTest { .toString(); // Build a mock running boot app - mockAppProvider.builder().isSpringBootApp(true).port("1111").processId("22022").host("cfapps.io") + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .port("1111") + .processID("22022") + .host("cfapps.io") .processName("test-conditionals-live-hover") .liveConditionalsJson("{\"negativeMatches\": {\n" + " \"MyConditionalComponent\": {\n" + " \"notMatched\": [\n" + " {\n" @@ -345,6 +388,7 @@ public class ConditionalsLiveHoverTest { + " }\n" + " ],\n" + " \"matched\": []\n" + " }\n" + "}\n" + "}") .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -368,7 +412,10 @@ public class ConditionalsLiveHoverTest { .toString(); // Build a mock running boot app - mockAppProvider.builder().isSpringBootApp(true).port("1111").processId("67950").host("cfapps.io") + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .port("1111") + .processID("67950") + .host("cfapps.io") .processName("test-conditionals-live-hover") .liveConditionalsJson("{\"negativeMatches\": {\n" + " \"MyConditionalComponent\": {\n" + " \"notMatched\": [\n" + " {\n" @@ -377,6 +424,7 @@ public class ConditionalsLiveHoverTest { + " }\n" + " ],\n" + " \"matched\": []\n" + " }\n" + "}\n" + "}") .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/ActiveProfilesHoverTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/ActiveProfilesHoverTest.java index 4c511ed13..95fc0f3d3 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/ActiveProfilesHoverTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/ActiveProfilesHoverTest.java @@ -10,19 +10,22 @@ *******************************************************************************/ package org.springframework.ide.vscode.boot.java.livehover.test; +import org.junit.After; 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.boot.java.livehover.v2.SpringProcessLiveData; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; 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.ide.vscode.project.harness.SpringProcessLiveDataBuilder; import org.springframework.test.context.junit4.SpringRunner; -import org.springframework.ide.vscode.boot.bootiful.HoverTestConf; @RunWith(SpringRunner.class) @BootLanguageServerTest @@ -31,26 +34,30 @@ public class ActiveProfilesHoverTest { private ProjectsHarness projects = ProjectsHarness.INSTANCE; - @Autowired - private BootLanguageServerHarness harness; - - @Autowired - private MockRunningAppProvider mockAppProvider; + @Autowired private BootLanguageServerHarness harness; + @Autowired private SpringProcessLiveDataProvider liveDataProvider; @Before public void setup() throws Exception { harness.useProject(projects.mavenProject("empty-boot-15-web-app")); harness.intialize(null); } + + @After + public void tearDown() throws Exception { + liveDataProvider.remove("processkey"); + liveDataProvider.remove("processkey1"); + liveDataProvider.remove("processkey2"); + } @Test public void testActiveProfileHover() throws Exception { - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("22022") + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("22022") .processName("foo.bar.RunningApp") - .profiles("testing-profile", "local-profile") + .activeProfiles("testing-profile", "local-profile") .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -84,12 +91,12 @@ public class ActiveProfilesHoverTest { //Make sure we show something sensible harness.useProject(projects.mavenProject("no-actuator-boot-15-web-app")); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("22022") + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("22022") .processName("foo.bar.RunningApp") - .profilesUnknown() + .activeProfiles((String[]) null) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -104,24 +111,24 @@ public class ActiveProfilesHoverTest { "}" ); editor.assertHoverContains("@Profile", "Consider adding `spring-boot-actuator` as a dependency"); - editor.assertHighlights(/*NONE*/); + editor.assertNoHighlights(); } @Test public void testActiveProfileHoverMixedKnownAndUnknown() throws Exception { - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("22022") + SpringProcessLiveData liveData1 = new SpringProcessLiveDataBuilder() + .processID("22022") .processName("foo.bar.NoActuatorApp") - .profilesUnknown() + .activeProfiles((String[]) null) .build(); + liveDataProvider.add("processkey1", liveData1); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("3456") + SpringProcessLiveData liveData2 = new SpringProcessLiveDataBuilder() + .processID("3456") .processName("foo.bar.NormalApp") - .profiles("fancy") + .activeProfiles("fancy") .build(); + liveDataProvider.add("processkey2", liveData2); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -156,6 +163,6 @@ public class ActiveProfilesHoverTest { "}" ); editor.assertNoHover("@Profile"); - editor.assertHighlights(/*NONE*/); + editor.assertNoHighlights(); } } diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/ActuatorWarningHoverTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/ActuatorWarningHoverTest.java index 3f9313127..bf1b4ab64 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/ActuatorWarningHoverTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/ActuatorWarningHoverTest.java @@ -10,18 +10,21 @@ *******************************************************************************/ package org.springframework.ide.vscode.boot.java.livehover.test; +import org.junit.After; 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.boot.java.livehover.v2.SpringProcessLiveData; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; import org.springframework.ide.vscode.commons.java.IJavaProject; 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.ide.vscode.project.harness.SpringProcessLiveDataBuilder; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @@ -34,16 +37,21 @@ public class ActuatorWarningHoverTest { private ProjectsHarness projects = ProjectsHarness.INSTANCE; @Autowired private BootLanguageServerHarness harness; - @Autowired private MockRunningAppProvider mockAppProvider; + @Autowired private SpringProcessLiveDataProvider liveDataProvider; + + @After + public void tearDown() throws Exception { + liveDataProvider.remove("processkey"); + } @Test public void showWarningIf_NoActuator_and_RunningApp() throws Exception { - //Has running app: - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("22022") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("22022") .processName("foo.bar.RunningApp") - .profilesUnknown() + .activeProfiles((String[]) null) .build(); + liveDataProvider.add("processkey", liveData); //No actuator on classpath: String projectName = NO_ACTUATOR_PROJECT; @@ -97,12 +105,12 @@ public class ActuatorWarningHoverTest { @Test public void noWarningIf_ActuatorOnClasspath() throws Exception { //Has running app: - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("22022") + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("22022") .processName("foo.bar.RunningApp") - .profilesUnknown() + .activeProfiles((String[]) null) .build(); + liveDataProvider.add("processkey", liveData); //Actuator on classpath: String projectName = ACTUATOR_PROJECT; @@ -135,12 +143,12 @@ public class ActuatorWarningHoverTest { // annotation name rather than the whole range of the ast node. //Has running app: - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("22022") + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("22022") .processName("foo.bar.RunningApp") - .profilesUnknown() + .activeProfiles((String[]) null) .build(); + liveDataProvider.add("processkey", liveData); //No actuator on classpath: String projectName = NO_ACTUATOR_PROJECT; diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/BeanInjectedIntoHoverProviderTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/BeanInjectedIntoHoverProviderTest.java index 0628b6110..7df9ecb34 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/BeanInjectedIntoHoverProviderTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/BeanInjectedIntoHoverProviderTest.java @@ -15,6 +15,7 @@ import static org.junit.Assert.assertTrue; import java.nio.file.Path; import java.nio.file.Paths; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -24,14 +25,16 @@ import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest; import org.springframework.ide.vscode.boot.bootiful.HoverTestConf; import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBean; import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBeansModel; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveData; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject; 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.ide.vscode.project.harness.ProjectsHarness.CustomizableProjectContent; import org.springframework.ide.vscode.project.harness.ProjectsHarness.ProjectCustomizer; +import org.springframework.ide.vscode.project.harness.SpringProcessLiveDataBuilder; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @@ -73,11 +76,8 @@ public class BeanInjectedIntoHoverProviderTest { private ProjectsHarness projects = ProjectsHarness.INSTANCE; - @Autowired - private BootLanguageServerHarness harness; - - @Autowired - private MockRunningAppProvider mockAppProvider; + @Autowired private BootLanguageServerHarness harness; + @Autowired private SpringProcessLiveDataProvider liveDataProvider; @Before public void setup() throws Exception { @@ -86,6 +86,11 @@ public class BeanInjectedIntoHoverProviderTest { harness.useProject(jp); harness.intialize(null); } + + @After + public void tearDown() throws Exception { + liveDataProvider.remove("processkey"); + } @Test public void beanWithNoInjections() throws Exception { @@ -96,12 +101,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -140,12 +146,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); String[] beanAnnotations = { "@Bean(value=\"beanId\")", @@ -204,12 +211,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -265,12 +273,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -333,12 +342,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -388,12 +398,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -440,12 +451,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -496,12 +508,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add(("processkey"), liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -541,12 +554,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("unrelated-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -605,12 +619,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -669,12 +684,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -744,12 +760,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + @@ -806,12 +823,13 @@ public class BeanInjectedIntoHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package hello;\n" + diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/BeansByTypeHoverProviderTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/BeansByTypeHoverProviderTest.java index 35dca7f92..66a1ae6c8 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/BeansByTypeHoverProviderTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/BeansByTypeHoverProviderTest.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.springframework.ide.vscode.boot.java.livehover.test; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -19,12 +20,14 @@ import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest; import org.springframework.ide.vscode.boot.bootiful.HoverTestConf; import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBean; import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBeansModel; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveData; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject; 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.ide.vscode.project.harness.SpringProcessLiveDataBuilder; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @@ -34,7 +37,7 @@ public class BeansByTypeHoverProviderTest { private ProjectsHarness projects = ProjectsHarness.INSTANCE; @Autowired private BootLanguageServerHarness harness; - @Autowired private MockRunningAppProvider mockAppProvider; + @Autowired private SpringProcessLiveDataProvider liveDataProvider; @Before public void setup() throws Exception { @@ -42,6 +45,11 @@ public class BeansByTypeHoverProviderTest { harness.useProject(jp); harness.intialize(null); } + + @After + public void tearDown() throws Exception { + liveDataProvider.remove("processkey"); + } @Test public void typeButNotABean() throws Exception { @@ -64,12 +72,13 @@ public class BeansByTypeHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -110,12 +119,13 @@ public class BeansByTypeHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -163,12 +173,13 @@ public class BeansByTypeHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -221,12 +232,13 @@ public class BeansByTypeHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -267,12 +279,13 @@ public class BeansByTypeHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -310,12 +323,13 @@ public class BeansByTypeHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/ComponentInjectionsHoverProviderTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/ComponentInjectionsHoverProviderTest.java index 299e50666..1ced60103 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/ComponentInjectionsHoverProviderTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/livehover/test/ComponentInjectionsHoverProviderTest.java @@ -12,6 +12,7 @@ package org.springframework.ide.vscode.boot.java.livehover.test; import static org.junit.Assert.assertTrue; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -21,14 +22,16 @@ import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest; import org.springframework.ide.vscode.boot.bootiful.HoverTestConf; import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBean; import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBeansModel; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveData; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject; 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.ide.vscode.project.harness.ProjectsHarness.CustomizableProjectContent; import org.springframework.ide.vscode.project.harness.ProjectsHarness.ProjectCustomizer; +import org.springframework.ide.vscode.project.harness.SpringProcessLiveDataBuilder; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @@ -63,7 +66,7 @@ public class ComponentInjectionsHoverProviderTest { private ProjectsHarness projects = ProjectsHarness.INSTANCE; @Autowired private BootLanguageServerHarness harness; - @Autowired private MockRunningAppProvider mockAppProvider; + @Autowired private SpringProcessLiveDataProvider liveDataProvider; @Before public void setup() throws Exception { @@ -72,6 +75,13 @@ public class ComponentInjectionsHoverProviderTest { harness.useProject(jp); harness.intialize(null); } + + @After + public void tearDown() throws Exception { + liveDataProvider.remove("processkey"); + liveDataProvider.remove("processkey1"); + liveDataProvider.remove("processkey2"); + } @Test public void componentWithNoInjections() throws Exception { @@ -82,12 +92,14 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -131,12 +143,13 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -184,12 +197,13 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -237,12 +251,14 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -293,12 +309,12 @@ public class ComponentInjectionsHoverProviderTest { ) .build(); for (int i = 1; i <= 2; i++) { - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("100"+i) - .processName("app-instance-"+i) - .beans(beans) - .build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("100"+i) + .processName("app-instance-"+i) + .beans(beans) + .build(); + liveDataProvider.add("processkey" + i, liveData); } Editor editor = harness.newEditor(LanguageId.JAVA, @@ -363,12 +379,14 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -421,12 +439,13 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -468,12 +487,13 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("unrelated-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -535,12 +555,13 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -589,12 +610,13 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -632,12 +654,13 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -677,12 +700,13 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -729,12 +753,13 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + @@ -777,12 +802,13 @@ public class ComponentInjectionsHoverProviderTest { .build() ) .build(); - mockAppProvider.builder() - .isSpringBootApp(true) - .processId("111") + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .processID("111") .processName("the-app") .beans(beans) .build(); + liveDataProvider.add("processkey", liveData); Editor editor = harness.newEditor(LanguageId.JAVA, "package com.example;\n" + diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/RequestMappingDependentConstantChangedTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/RequestMappingDependentConstantChangedTest.java index 7d28dc54c..7f7fbe24c 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/RequestMappingDependentConstantChangedTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/requestmapping/test/RequestMappingDependentConstantChangedTest.java @@ -5,12 +5,10 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.File; -import java.io.IOException; import java.nio.file.Path; import java.util.List; import java.util.Optional; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import org.apache.commons.io.FileUtils; 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 938609cb5..faa82b35a 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 @@ -10,10 +10,9 @@ *******************************************************************************/ package org.springframework.ide.vscode.boot.java.requestmapping.test; -import static org.junit.Assert.assertTrue; - import java.io.File; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -21,28 +20,36 @@ 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.boot.java.livehover.v2.SpringProcessLiveData; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; 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.MockRequestMapping; -import org.springframework.ide.vscode.project.harness.MockRunningAppProvider; import org.springframework.ide.vscode.project.harness.ProjectsHarness; +import org.springframework.ide.vscode.project.harness.SpringProcessLiveDataBuilder; import org.springframework.test.context.junit4.SpringRunner; -import com.google.common.collect.ImmutableList; - @RunWith(SpringRunner.class) @BootLanguageServerTest @Import(HoverTestConf.class) public class RequestMappingLiveHoverTest { @Autowired BootLanguageServerHarness harness; - @Autowired MockRunningAppProvider mockAppProvider; + @Autowired SpringProcessLiveDataProvider liveDataProvider; @Before public void setup() throws Exception { harness.useProject(ProjectsHarness.INSTANCE.mavenProject("test-request-mapping-live-hover")); } + + @After + public void tearDown() throws Exception { + liveDataProvider.remove("processkey"); + liveDataProvider.remove("processkey1"); + liveDataProvider.remove("processkey2"); + liveDataProvider.remove("processkey3"); + } @Test public void testLiveHoverHintTypeMapping() throws Exception { @@ -53,18 +60,18 @@ public class RequestMappingLiveHoverTest { .toString(); // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) - .port("1111") - .processId("22022") - .host("cfapps.io") - .urlScheme("https") - .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( + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .port("1111") + .processID("22022") + .host("cfapps.io") + .urlScheme("https") + .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(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -82,22 +89,22 @@ public class RequestMappingLiveHoverTest { ProjectsHarness.class.getResource("/test-projects/test-request-mapping-live-hover/").toURI()); String docUri = directory.toPath().resolve("src/main/java/example/HelloWorldController.java").toUri() .toString(); - - mockAppProvider.builder() - .isSpringBootApp(true) - .port("1111") - .processId("22022") - .host("cfapps.io") - .urlScheme("https") - .processName("test-request-mapping-live-hover") - .requestMappings(ImmutableList.of( - new MockRequestMapping() - .className("example.HelloWorldController") - .methodName("sayHello") - .methodParams("java.lang.String") - .paths() - )) - .build(); + + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .port("1111") + .processID("22022") + .host("cfapps.io") + .urlScheme("https") + .processName("test-request-mapping-live-hover") + .requestMappings( + new MockRequestMapping() + .className("example.HelloWorldController") + .methodName("sayHello") + .methodParams("java.lang.String") + .paths() + ) + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -139,18 +146,18 @@ public class RequestMappingLiveHoverTest { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) - .port("999") - .processId("76543") - .urlScheme("https") - .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)\"}}") - . build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .port("999") + .processID("76543") + .urlScheme("https") + .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)\"}}") + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -175,9 +182,6 @@ public class RequestMappingLiveHoverTest { harness.intialize(directory); - assertTrue("Expected no mock running boot apps, but found: " + mockAppProvider.mockedApps, - mockAppProvider.mockedApps.isEmpty()); - Editor editorWithMethodLiveHover = harness.newEditorFromFileUri(docUri, LanguageId.JAVA); editorWithMethodLiveHover.assertNoHover("@RequestMapping(\"/hello\")"); @@ -201,18 +205,18 @@ public class RequestMappingLiveHoverTest { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) - .port("999") - .processId("76543") - .urlScheme("https") - .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( - "{\"{[/greetings],methods=[DELETE]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public void com.example.RestApi.deleteGreetings()\"}}") - . build(); + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() + .port("999") + .processID("76543") + .urlScheme("https") + .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( + "{\"{[/greetings],methods=[DELETE]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public void com.example.RestApi.deleteGreetings()\"}}") + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -248,17 +252,17 @@ public class RequestMappingLiveHoverTest { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("999") - .processId("76543") + .processID("76543") .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( "{\"{[/greetings],methods=[DELETE]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public void com.example.RestApi.deleteGreetings()\"}}") - . build(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -291,17 +295,17 @@ public class RequestMappingLiveHoverTest { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("999") - .processId("76543") + .processID("76543") .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( "{\"{[/greetings],methods=[PUT]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public java.lang.String com.example.RestApi.updateGreetings()\"}}") - . build(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -335,10 +339,9 @@ public class RequestMappingLiveHoverTest { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("999") - .processId("76543") + .processID("76543") .urlScheme("https") .host("cfapps.io") .processName("test-request-mapping-live-hover") @@ -346,7 +349,8 @@ public class RequestMappingLiveHoverTest { // 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(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -383,10 +387,9 @@ public class RequestMappingLiveHoverTest { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("999") - .processId("76543") + .processID("76543") .host("cfapps.io") .urlScheme("https") .processName("test-request-mapping-live-hover") @@ -394,7 +397,8 @@ public class RequestMappingLiveHoverTest { // mock app to return realistic results if possible .requestMappingsJson( "{\"{[/find],methods=[GET]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public org.springframework.http.ResponseEntity com.example.RestApi.find(java.lang.String,java.util.Date,java.lang.String)\"}}") - . build(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -434,10 +438,9 @@ public class RequestMappingLiveHoverTest { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("999") - .processId("76543") + .processID("76543") .urlScheme("https") .host("cfapps.io") .processName("test-request-mapping-live-hover") @@ -445,7 +448,8 @@ public class RequestMappingLiveHoverTest { // mock app to return realistic results if possible .requestMappingsJson( "{\"{[/find],methods=[GET]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public java.lang.Object com.example.RestApi.set(java.lang.String,java.util.Map)\"}}") - . build(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -483,12 +487,10 @@ public class RequestMappingLiveHoverTest { String docUri = directory.toPath().resolve("src/main/java/example/RestApi.java").toUri() .toString(); - // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("999") - .processId("76543") + .processID("76543") .urlScheme("https") .host("cfapps.io") .processName("test-request-mapping-live-hover") @@ -496,7 +498,8 @@ public class RequestMappingLiveHoverTest { // mock app to return realistic results if possible .requestMappingsJson( "{\"{[/find],methods=[GET]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public java.lang.Object com.example.RestApi.set(java.lang.String,java.util.Map>)\"}}") - . build(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -535,12 +538,10 @@ public class RequestMappingLiveHoverTest { String docUri = directory.toPath().resolve("src/main/java/example/RestApi.java").toUri() .toString(); - // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("999") - .processId("76543") + .processID("76543") .urlScheme("https") .host("cfapps.io") .processName("test-request-mapping-live-hover") @@ -548,7 +549,8 @@ public class RequestMappingLiveHoverTest { // mock app to return realistic results if possible .requestMappingsJson( "{\"{[/find],methods=[GET]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public java.lang.Object com.example.RestApi.set(java.lang.String,java.util.Map>)\"}}") - . build(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -587,12 +589,10 @@ public class RequestMappingLiveHoverTest { String docUri = directory.toPath().resolve("src/main/java/example/RestApi.java").toUri() .toString(); - // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("999") - .processId("76543") + .processID("76543") .urlScheme("https") .host("cfapps.io") .processName("test-request-mapping-live-hover") @@ -600,7 +600,8 @@ public class RequestMappingLiveHoverTest { // mock app to return realistic results if possible .requestMappingsJson( "{\"{[/find],methods=[GET]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public java.lang.Object com.example.RestApi.set(java.lang.String[])\"}}") - . build(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -637,12 +638,10 @@ public class RequestMappingLiveHoverTest { String docUri = directory.toPath().resolve("src/main/java/example/RestApi.java").toUri() .toString(); - // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("999") - .processId("76543") + .processID("76543") .urlScheme("https") .host("cfapps.io") .processName("test-request-mapping-live-hover") @@ -650,7 +649,8 @@ public class RequestMappingLiveHoverTest { // mock app to return realistic results if possible .requestMappingsJson( "{\"{[/find],methods=[GET]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public java.lang.Object com.example.RestApi.set(java.lang.String[][])\"}}") - . build(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -686,12 +686,10 @@ public class RequestMappingLiveHoverTest { String docUri = directory.toPath().resolve("src/main/java/example/RestApi.java").toUri() .toString(); - // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("999") - .processId("76543") + .processID("76543") .urlScheme("https") .host("cfapps.io") .processName("test-request-mapping-live-hover") @@ -699,7 +697,8 @@ public class RequestMappingLiveHoverTest { // mock app to return realistic results if possible .requestMappingsJson( "{\"{[/find],methods=[GET]}\": {\"bean\": \"requestMappingHandlerMapping\", \"method\":\"public java.lang.Object com.example.RestApi.set(java.lang.String...)\"}}") - . build(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -736,10 +735,9 @@ public class RequestMappingLiveHoverTest { .toString(); // Build three different instances of the same app running on different ports with different process IDs - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData1 = new SpringProcessLiveDataBuilder() .port("1000") - .processId("70000") + .processID("70000") .urlScheme("https") .host("cfapps.io") .processName("test-request-mapping-live-hover") @@ -747,12 +745,12 @@ public class RequestMappingLiveHoverTest { // 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(); + .build(); + liveDataProvider.add("processkey1", liveData1); - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData2 = new SpringProcessLiveDataBuilder() .port("1001") - .processId("80000") + .processID("80000") .urlScheme("https") .host("cfapps.io") .processName("test-request-mapping-live-hover") @@ -760,12 +758,12 @@ public class RequestMappingLiveHoverTest { // 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(); + .build(); + liveDataProvider.add("processkey2", liveData2); - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData3 = new SpringProcessLiveDataBuilder() .port("1002") - .processId("90000") + .processID("90000") .urlScheme("https") .host("cfapps.io") .processName("test-request-mapping-live-hover") @@ -773,7 +771,9 @@ public class RequestMappingLiveHoverTest { // 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(); + .build(); + liveDataProvider.add("processkey3", liveData3); + harness.intialize(directory); Editor editor = harness.newEditorFromFileUri(docUri, LanguageId.JAVA); @@ -797,19 +797,18 @@ public class RequestMappingLiveHoverTest { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("999") - .processId("76543") + .processID("76543") .urlScheme("https") .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( + .requestMappingsJson( "{\"/webjars/**\":{\"bean\":\"resourceHandlerMapping\"},\"/**\":{\"bean\":\"resourceHandlerMapping\"},\"/**/favicon.ico\":{\"bean\":\"faviconHandlerMapping\"},\"{[/goodbye]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.goodbye()\"},\"{[/delete/{id}],methods=[DELETE]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.removeMe(int)\"},\"{[/hello]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.hello()\"},\"{[/postHello],methods=[POST]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.postMethod(java.lang.String)\"},\"{[/put/{id}],methods=[PUT]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.putMethod(int,java.lang.String)\"},\"{[/person/{name}],methods=[GET]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.getMapping(java.lang.String)\"},\"{[/error]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public org.springframework.http.ResponseEntity> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)\"},\"{[/error],produces=[text/html]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)\"},\"{[/application/status],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}\":{\"bean\":\"webEndpointServletHandlerMapping\",\"method\":\"public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)\"},\"{[/application/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}\":{\"bean\":\"webEndpointServletHandlerMapping\",\"method\":\"public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map)\"},\"{[/application],methods=[GET]}\":{\"bean\":\"webEndpointServletHandlerMapping\",\"method\":\"private java.util.Map> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest)\"}}") - - .build(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -831,10 +830,9 @@ public class RequestMappingLiveHoverTest { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .urlScheme("https") .host("cfapps.io") .processName("test-request-mapping-live-hover") @@ -843,6 +841,7 @@ public class RequestMappingLiveHoverTest { .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)\"},\"{[/inner-inner-class]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.InnerClassController$InnerController$InnerInnerController.saySomethingSuperInnerClass()\"},\"{[/inner-class]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.InnerClassController$InnerController.saySomething()\"},\"{[/person/{name}],methods=[GET]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.getMapping(java.lang.String)\"},\"{[/delete/{id}],methods=[DELETE]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.removeMe(int)\"},\"{[/goodbye]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.goodbye()\"},\"{[/hello]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.hello()\"},\"{[/postHello],methods=[POST]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.postMethod(java.lang.String)\"},\"{[/put/{id}],methods=[PUT]}\":{\"bean\":\"requestMappingHandlerMapping\",\"method\":\"public java.lang.String example.RestApi.putMethod(int,java.lang.String)\"},\"{[/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(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); 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 index 9217b1a67..f735edb22 100644 --- 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 @@ -12,6 +12,7 @@ package org.springframework.ide.vscode.boot.java.requestmapping.test; import java.io.File; +import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -19,11 +20,13 @@ 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.boot.java.livehover.v2.SpringProcessLiveData; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveDataProvider; 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.ide.vscode.project.harness.SpringProcessLiveDataBuilder; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @@ -31,14 +34,19 @@ import org.springframework.test.context.junit4.SpringRunner; @Import(HoverTestConf.class) public class RequestMappingLiveHoverTestWithContextPath { - @Autowired BootLanguageServerHarness harness; - @Autowired MockRunningAppProvider mockAppProvider; + @Autowired private BootLanguageServerHarness harness; + @Autowired private SpringProcessLiveDataProvider liveDataProvider; @Before public void setup() throws Exception { harness.useProject(ProjectsHarness.INSTANCE.mavenProject("test-request-mapping-live-hover")); } + @After + public void tearDown() throws Exception { + liveDataProvider.remove("processkey"); + } + @Test public void testBoot1xActualActuatorEnvProp() throws Exception { @@ -51,10 +59,9 @@ public class RequestMappingLiveHoverTestWithContextPath { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .host("cfapps.io") .urlScheme("https") .processName("test-request-mapping-live-hover") @@ -64,6 +71,7 @@ public class RequestMappingLiveHoverTestWithContextPath { "{\"/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(bootVersion, AcuatorEnvTestConstants.BOOT_1x_ENV) .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -87,10 +95,9 @@ public class RequestMappingLiveHoverTestWithContextPath { String bootVersion = "1.x"; // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .host("cfapps.io") .urlScheme("https") .processName("test-request-mapping-live-hover") @@ -100,6 +107,7 @@ public class RequestMappingLiveHoverTestWithContextPath { "{\"/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(bootVersion, AcuatorEnvTestConstants.BOOT_1x_COMMAND_LINE_ARG_CAMEL_CASE) .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -124,10 +132,9 @@ public class RequestMappingLiveHoverTestWithContextPath { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .host("cfapps.io") .urlScheme("https") .processName("test-request-mapping-live-hover") @@ -137,6 +144,7 @@ public class RequestMappingLiveHoverTestWithContextPath { "{\"/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(bootVersion, AcuatorEnvTestConstants.BOOT_1x_COMMAND_LINE_ARG_KEBAB_CASE) .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -161,10 +169,9 @@ public class RequestMappingLiveHoverTestWithContextPath { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .host("cfapps.io") .urlScheme("https") .processName("test-request-mapping-live-hover") @@ -174,6 +181,7 @@ public class RequestMappingLiveHoverTestWithContextPath { "{\"/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(bootVersion, AcuatorEnvTestConstants.BOOT_1x_APP_CONFIG_FILE_KEBAB_CASE) .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -198,10 +206,9 @@ public class RequestMappingLiveHoverTestWithContextPath { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .host("cfapps.io") .urlScheme("https") .processName("test-request-mapping-live-hover") @@ -211,6 +218,7 @@ public class RequestMappingLiveHoverTestWithContextPath { "{\"/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(bootVersion, AcuatorEnvTestConstants.BOOT_1x_APP_CONFIG_FILE_CAMEL_CASE) .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -234,10 +242,9 @@ public class RequestMappingLiveHoverTestWithContextPath { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .host("cfapps.io") .urlScheme("https") .processName("test-request-mapping-live-hover") @@ -247,6 +254,7 @@ public class RequestMappingLiveHoverTestWithContextPath { "{\"/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(bootVersion, AcuatorEnvTestConstants.BOOT_2x_ENV) .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -270,10 +278,9 @@ public class RequestMappingLiveHoverTestWithContextPath { String bootVersion = "2.x"; // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .host("cfapps.io") .urlScheme("https") .processName("test-request-mapping-live-hover") @@ -283,6 +290,7 @@ public class RequestMappingLiveHoverTestWithContextPath { "{\"/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(bootVersion, AcuatorEnvTestConstants.BOOT_2x_COMMAND_LINE_ARG_CAMEL_CASE) .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -307,10 +315,9 @@ public class RequestMappingLiveHoverTestWithContextPath { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .host("cfapps.io") .urlScheme("https") .processName("test-request-mapping-live-hover") @@ -320,6 +327,7 @@ public class RequestMappingLiveHoverTestWithContextPath { "{\"/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(bootVersion, AcuatorEnvTestConstants.BOOT_2x_COMMAND_LINE_ARG_KEBAB_CASE) .build(); + liveDataProvider.add("prcesskey", liveData); harness.intialize(directory); @@ -344,10 +352,9 @@ public class RequestMappingLiveHoverTestWithContextPath { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .host("cfapps.io") .urlScheme("https") .processName("test-request-mapping-live-hover") @@ -357,6 +364,7 @@ public class RequestMappingLiveHoverTestWithContextPath { "{\"/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(bootVersion, AcuatorEnvTestConstants.BOOT_2x_APP_CONFIG_FILE_KEBAB_CASE) .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -381,10 +389,9 @@ public class RequestMappingLiveHoverTestWithContextPath { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .host("cfapps.io") .urlScheme("https") .processName("test-request-mapping-live-hover") @@ -394,6 +401,7 @@ public class RequestMappingLiveHoverTestWithContextPath { "{\"/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(bootVersion, AcuatorEnvTestConstants.BOOT_2x_APP_CONFIG_FILE_CAMEL_CASE) .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -420,10 +428,9 @@ public class RequestMappingLiveHoverTestWithContextPath { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .host("cfapps.io") .urlScheme("https") .processName("test-request-mapping-live-hover") @@ -433,6 +440,7 @@ public class RequestMappingLiveHoverTestWithContextPath { "{\"/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(bootVersion, AcuatorEnvTestConstants.BOOT_2x_PROPERTY_SOURCE_PRIORITY) .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -455,10 +463,9 @@ public class RequestMappingLiveHoverTestWithContextPath { .toString(); // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("1111") - .processId("22022") + .processID("22022") .host("cfapps.io") .urlScheme("https") .contextPath("/mockedpath") @@ -468,6 +475,7 @@ public class RequestMappingLiveHoverTestWithContextPath { .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(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); @@ -488,10 +496,9 @@ public class RequestMappingLiveHoverTestWithContextPath { // Build a mock running boot app - mockAppProvider.builder() - .isSpringBootApp(true) + SpringProcessLiveData liveData = new SpringProcessLiveDataBuilder() .port("999") - .processId("76543") + .processID("76543") .host("cfapps.io") .urlScheme("https") .contextPath("/mockedpath") @@ -500,7 +507,8 @@ public class RequestMappingLiveHoverTestWithContextPath { // 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(); + .build(); + liveDataProvider.add("processkey", liveData); harness.intialize(directory); diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/utils/test/CompilationUnitCacheTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/utils/test/CompilationUnitCacheTest.java index aae0d6010..570f8f03b 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/utils/test/CompilationUnitCacheTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/utils/test/CompilationUnitCacheTest.java @@ -34,7 +34,6 @@ import org.springframework.ide.vscode.boot.bootiful.AdHocPropertyHarnessTestConf import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest; import org.springframework.ide.vscode.boot.editor.harness.PropertyIndexHarness; import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; import org.springframework.ide.vscode.boot.java.links.SourceLinkFactory; import org.springframework.ide.vscode.boot.java.links.SourceLinks; import org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache; @@ -83,10 +82,6 @@ public class CompilationUnitCacheTest { return new PropertyIndexHarness(valueProviders); } - @Bean RunningAppProvider runningAppProvider() { - return RunningAppProvider.NULL; - } - @Bean JavaProjectFinder projectFinder(BootLanguageServerParams serverParams) { return serverParams.projectFinder; } @@ -105,8 +100,7 @@ public class CompilationUnitCacheTest { indexHarness.getProjectFinder(), projectObserver, indexHarness.getIndexProvider(), - testDefaults.typeUtilProvider, - null + testDefaults.typeUtilProvider ); } diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/value/test/ValueCompletionTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/value/test/ValueCompletionTest.java index 3db81d3de..c1fb6a8e6 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/value/test/ValueCompletionTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/java/value/test/ValueCompletionTest.java @@ -22,7 +22,6 @@ import java.util.Optional; import org.apache.commons.io.IOUtils; import org.eclipse.lsp4j.CompletionItem; import org.eclipse.lsp4j.TextDocumentIdentifier; -import org.eclipse.xtend.lib.annotations.Accessors; import org.gradle.internal.impldep.com.google.common.collect.ImmutableList; import org.junit.Before; import org.junit.Test; @@ -36,15 +35,12 @@ import org.springframework.ide.vscode.boot.bootiful.AdHocPropertyHarnessTestConf import org.springframework.ide.vscode.boot.bootiful.BootLanguageServerTest; import org.springframework.ide.vscode.boot.editor.harness.AdHocPropertyHarness; import org.springframework.ide.vscode.boot.editor.harness.PropertyIndexHarness; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; import org.springframework.ide.vscode.boot.java.links.SourceLinkFactory; import org.springframework.ide.vscode.boot.java.links.SourceLinks; import org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache; import org.springframework.ide.vscode.boot.java.utils.SymbolCache; import org.springframework.ide.vscode.boot.java.utils.SymbolCacheVoid; import org.springframework.ide.vscode.boot.java.value.ValueCompletionProcessor; -import org.springframework.ide.vscode.boot.metadata.AdHocSpringPropertyIndexProvider; -import org.springframework.ide.vscode.boot.metadata.SpringPropertyIndexProvider; import org.springframework.ide.vscode.boot.metadata.ValueProviderRegistry; import org.springframework.ide.vscode.commons.java.IJavaProject; import org.springframework.ide.vscode.commons.languageserver.java.JavaProjectFinder; @@ -117,8 +113,7 @@ public class ValueCompletionTest { projectFinder, ProjectObserver.NULL, indexHarness.getIndexProvider(), - testDefaults.typeUtilProvider, - null + testDefaults.typeUtilProvider ); } @@ -130,9 +125,6 @@ public class ValueCompletionTest { return SourceLinkFactory.NO_SOURCE_LINKS; } - @Bean RunningAppProvider runningAppProvider() { - return RunningAppProvider.NULL; - } } @Before diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/DynamicRequestMappingSymbolTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/DynamicRequestMappingSymbolTest.java index d83c1df2a..7e0c930ac 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/DynamicRequestMappingSymbolTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/DynamicRequestMappingSymbolTest.java @@ -1,91 +1,88 @@ package org.springframework.ide.vscode.boot.test; -import org.junit.Test; +import org.junit.Ignore; 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.languageserver.testharness.LanguageServerHarness; -import org.springframework.ide.vscode.project.harness.MockRequestMapping; -import org.springframework.ide.vscode.project.harness.MockRunningAppProvider; import org.springframework.test.context.junit4.SpringRunner; -import com.google.common.collect.ImmutableList; - @RunWith(SpringRunner.class) @BootLanguageServerTest @Import(HoverTestConf.class) +@Ignore public class DynamicRequestMappingSymbolTest { @Autowired LanguageServerHarness harness; - @Autowired MockRunningAppProvider mockApps; - - @Test - public void runningAppProviderRequestMappingSymbol() throws Exception { - mockApps.builder() - .isSpringBootApp(true) - .port("1111") - .processId("22022") - .host("cfapps.io") - .urlScheme("https") - .processName("test-request-mapping-live-hover") - .requestMappings(ImmutableList.of( - new MockRequestMapping() - .className("example.HelloWorldController") - .methodName("sayHello") - .methodParams("java.lang.String") - .paths("/blah") - )) - .build(); - harness.assertWorkspaceSymbols("//", - "https://cfapps.io:1111/blah" - ); - } - - @Test - public void noPaths() throws Exception { - mockApps.builder() - .isSpringBootApp(true) - .port("1111") - .processId("22022") - .host("cfapps.io") - .urlScheme("https") - .processName("test-request-mapping-live-hover") - .requestMappings(ImmutableList.of( - new MockRequestMapping() - .className("example.HelloWorldController") - .methodName("sayHello") - .methodParams("java.lang.String") - .paths() - )) - .build(); - harness.assertWorkspaceSymbols("//", - "https://cfapps.io:1111/" - ); - } - - @Test - public void multiplePaths() throws Exception { - mockApps.builder() - .isSpringBootApp(true) - .port("80") - .processId("22022") - .host("localhost") - .urlScheme("http") - .processName("test-request-mapping-live-hover") - .requestMappings(ImmutableList.of( - new MockRequestMapping() - .className("example.HelloWorldController") - .methodName("sayHello") - .methodParams("java.lang.String") - .paths("foo", "/bar") - )) - .build(); - harness.assertWorkspaceSymbols("//", - "http://localhost/foo", - "http://localhost/bar" - ); - } +// @Autowired MockRunningAppProvider mockApps; +// +// @Test +// public void runningAppProviderRequestMappingSymbol() throws Exception { +// mockApps.builder() +// .isSpringBootApp(true) +// .port("1111") +// .processId("22022") +// .host("cfapps.io") +// .urlScheme("https") +// .processName("test-request-mapping-live-hover") +// .requestMappings(ImmutableList.of( +// new MockRequestMapping() +// .className("example.HelloWorldController") +// .methodName("sayHello") +// .methodParams("java.lang.String") +// .paths("/blah") +// )) +// .build(); +// harness.assertWorkspaceSymbols("//", +// "https://cfapps.io:1111/blah" +// ); +// } +// +// @Test +// public void noPaths() throws Exception { +// mockApps.builder() +// .isSpringBootApp(true) +// .port("1111") +// .processId("22022") +// .host("cfapps.io") +// .urlScheme("https") +// .processName("test-request-mapping-live-hover") +// .requestMappings(ImmutableList.of( +// new MockRequestMapping() +// .className("example.HelloWorldController") +// .methodName("sayHello") +// .methodParams("java.lang.String") +// .paths() +// )) +// .build(); +// harness.assertWorkspaceSymbols("//", +// "https://cfapps.io:1111/" +// ); +// } +// +// @Test +// public void multiplePaths() throws Exception { +// mockApps.builder() +// .isSpringBootApp(true) +// .port("80") +// .processId("22022") +// .host("localhost") +// .urlScheme("http") +// .processName("test-request-mapping-live-hover") +// .requestMappings(ImmutableList.of( +// new MockRequestMapping() +// .className("example.HelloWorldController") +// .methodName("sayHello") +// .methodParams("java.lang.String") +// .paths("foo", "/bar") +// )) +// .build(); +// harness.assertWorkspaceSymbols("//", +// "http://localhost/foo", +// "http://localhost/bar" +// ); +// } } diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/project/harness/MockRequestMapping.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/project/harness/MockRequestMapping.java index 2e63ccb46..54f0916e7 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/project/harness/MockRequestMapping.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/project/harness/MockRequestMapping.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2017, 2019 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.vscode.project.harness; import java.util.Set; 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 deleted file mode 100644 index 49996be3f..000000000 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/project/harness/MockRunningAppProvider.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2017, 2019 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.vscode.project.harness; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Optional; -import java.util.Properties; - -import org.mockito.Mockito; -import org.springframework.ide.vscode.boot.java.handlers.RunningAppProvider; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveContextPathUtil; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBeansModel; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveConditional; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveProperties; -import org.springframework.ide.vscode.boot.java.livehover.v2.LivePropertiesJsonParser; -import org.springframework.ide.vscode.boot.java.livehover.v2.LiveRequestMapping; -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.util.ExceptionUtil; - -import com.google.common.collect.ImmutableList; - -public class MockRunningAppProvider { - - public final RunningAppProvider provider = mock(RunningAppProvider.class); - public final Collection mockedApps = new ArrayList<>(); - - public MockRunningAppProvider() { - try { - when(provider.getAllRunningSpringApps()).thenReturn(mockedApps); - } catch (Exception e) { - throw ExceptionUtil.unchecked(e); - } - } - - /** - * Reset the mocks. Use this if the default's programmed into the mocks don't - * suite your test case. - *

- * Note: you may also choose to call {@link Mockito}.mock directly if you do not - * want to reset all of the mocks. - */ - public void reset() throws Exception { - mockedApps.clear(); - Mockito.reset(provider); - } - - public MockAppBuilder builder() throws Exception { - return new MockAppBuilder(this); - } - - public static class MockAppBuilder { - public final SpringBootApp app = mock(SpringBootApp.class); - private MockRunningAppProvider runningAppProvider; - private String processId; - private String processName; - - public MockAppBuilder(MockRunningAppProvider runningAppProvider) throws Exception { - this.runningAppProvider = runningAppProvider; - when(app.getUrlScheme()).thenReturn("http"); - } - - public MockAppBuilder beans(String beans) throws Exception { - return beans(LiveBeansModel.parse(beans)); - } - - public MockAppBuilder beans(LiveBeansModel beans) { - when(app.getBeans()).thenReturn(beans); - return this; - } - - public MockAppBuilder processId(String processId) { - this.processId = processId; - when(app.getProcessID()).thenReturn(processId); - return this; - } - - public MockAppBuilder processName(String name) throws Exception { - this.processName = name; - when(app.getProcessName()).thenReturn(name); - return this; - } - - public MockAppBuilder contextPath(String contextPath) throws Exception { - when(app.getContextPath()).thenReturn(contextPath); - return this; - } - - public MockAppBuilder contextPathEnvJson(String bootVersion, String envJson) throws Exception { - String contextPath = LiveContextPathUtil.getContextPath(bootVersion, envJson); - when(app.getContextPath()).thenReturn(contextPath); - return this; - } - - public MockAppBuilder port(String port) throws Exception { - when(app.getPort()).thenReturn(port); - return this; - } - - public MockAppBuilder host(String host) throws Exception { - when(app.getHost()).thenReturn(host); - return this; - } - - public MockAppBuilder urlScheme(String urlScheme) throws Exception { - when(app.getUrlScheme()).thenReturn(urlScheme); - return this; - } - - public MockAppBuilder isSpringBootApp(boolean isBoot) throws Exception { - when(app.hasUsefulJmxBeans()).thenReturn(isBoot); - return this; - } - - public MockAppBuilder requestMappingsJson(String mappings) throws Exception { - Collection requestMappings = LocalSpringBootApp.parseRequestMappingsJson(mappings, "1.x"); - when(app.getRequestMappings()).thenReturn(requestMappings); - return this; - } - - public MockAppBuilder requestMappings(Collection rms) throws Exception { - when(app.getRequestMappings()).thenReturn(rms); - return this; - } - - public MockAppBuilder liveConditionalsJson(String rawJson) throws Exception{ - when(app.getLiveConditionals()).thenReturn(LocalSpringBootApp.getLiveConditionals(rawJson, processId, processName)); - return this; - } - - public MockAppBuilder livePropertiesJson(String envJson) throws Exception{ - when(app.getLiveProperties()).thenReturn(LivePropertiesJsonParser.parseProperties(envJson)); - return this; - } - - public MockAppBuilder profiles(String... names) { - when(app.getActiveProfiles()).thenReturn(ImmutableList.copyOf(names)); - return this; - } - - public MockAppBuilder profilesUnknown() { - //Note, technically, we don't have to program the mock for this case as it will return - // null by default. But it makes test code more readable. Also... how we represent the - // 'unknown' case may change in the future and having this method will help fix the tests. - when(app.getActiveProfiles()).thenReturn(null); - return this; - } - - - /** - * Builds the mock app and adds it to the app provider - */ - public void build() { - runningAppProvider.mockedApps.add(app); - } - - } -} diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/project/harness/SpringProcessLiveDataBuilder.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/project/harness/SpringProcessLiveDataBuilder.java new file mode 100644 index 000000000..2480989f7 --- /dev/null +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/project/harness/SpringProcessLiveDataBuilder.java @@ -0,0 +1,129 @@ +/******************************************************************************* + * Copyright (c) 2019 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.vscode.project.harness; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.json.JSONObject; +import org.springframework.ide.vscode.boot.java.livehover.v2.LiveBeansModel; +import org.springframework.ide.vscode.boot.java.livehover.v2.LiveConditional; +import org.springframework.ide.vscode.boot.java.livehover.v2.LiveConditionalParser; +import org.springframework.ide.vscode.boot.java.livehover.v2.LiveContextPathUtil; +import org.springframework.ide.vscode.boot.java.livehover.v2.LiveProperties; +import org.springframework.ide.vscode.boot.java.livehover.v2.LiveRequestMapping; +import org.springframework.ide.vscode.boot.java.livehover.v2.LiveRequestMappingBoot1xRequestMapping; +import org.springframework.ide.vscode.boot.java.livehover.v2.SpringProcessLiveData; + +/** + * @author Martin Lippert + */ +public class SpringProcessLiveDataBuilder { + + private String processName; + private String processID; + + private String contextPath; + private String urlScheme; + private String port; + private String host; + + private LiveBeansModel beansModel; + private String[] activeProfiles; + private LiveRequestMapping[] requestMappings; + private LiveConditional[] conditionals; + private LiveProperties properties; + + public SpringProcessLiveDataBuilder processName(String processName) { + this.processName = processName; + return this; + } + + public SpringProcessLiveDataBuilder processID(String processID) { + this.processID = processID; + return this; + } + + public SpringProcessLiveDataBuilder contextPath(String contextPath) { + this.contextPath = contextPath; + return this; + } + + public SpringProcessLiveDataBuilder contextPathEnvJson(String bootVersion, String envJson) { + this.contextPath = LiveContextPathUtil.getContextPath(bootVersion, envJson); + return this; + } + + public SpringProcessLiveDataBuilder urlScheme(String urlScheme) { + this.urlScheme = urlScheme; + return this; + } + + public SpringProcessLiveDataBuilder port(String port) { + this.port = port; + return this; + } + + public SpringProcessLiveDataBuilder host(String host) { + this.host = host; + return this; + } + + public SpringProcessLiveDataBuilder beans(LiveBeansModel beansModel) { + this.beansModel = beansModel; + return this; + } + + public SpringProcessLiveDataBuilder activeProfiles(String... activeProfiles) { + this.activeProfiles = activeProfiles; + return this; + } + + public SpringProcessLiveDataBuilder requestMappings(LiveRequestMapping... requestMappings) { + this.requestMappings = requestMappings; + return this; + } + + public SpringProcessLiveDataBuilder requestMappingsJson(String json) { + JSONObject obj = new JSONObject(json); + + List result = new ArrayList<>(); + Iterator keys = obj.keys(); + while (keys.hasNext()) { + String rawKey = keys.next(); + JSONObject value = obj.getJSONObject(rawKey); + result.add(new LiveRequestMappingBoot1xRequestMapping(rawKey, value)); + } + this.requestMappings = result.toArray(new LiveRequestMapping[result.size()]); + return this; + } + + public SpringProcessLiveDataBuilder liveConditionals(LiveConditional[] conditionals) { + this.conditionals = conditionals; + return this; + } + + public SpringProcessLiveDataBuilder liveConditionalsJson(String json) { + this.conditionals = LiveConditionalParser.parse(json, processID, processName); + return this; + } + + public SpringProcessLiveDataBuilder getLiveProperties(LiveProperties properties) { + this.properties = properties; + return this; + } + + public SpringProcessLiveData build() { + return new SpringProcessLiveData(processName, processID, contextPath, urlScheme, port, host, beansModel, activeProfiles, requestMappings, conditionals, properties); + } + +}