code cleanup and test case update to new mechanism
This commit is contained in:
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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" +
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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" +
|
||||
|
||||
@@ -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" +
|
||||
|
||||
@@ -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" +
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.lang.String, java.lang.String>)\"}}")
|
||||
. 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<java.lang.String, java.util.Map<java.lang.String, java.lang.Integer>>)\"}}")
|
||||
. 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<java.lang.String, java.util.Map<java.lang.String, ? extends java.lang.Integer>>)\"}}")
|
||||
. 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.lang.String, java.lang.String>)\"},\"{[/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<java.lang.String, java.lang.String>)\"},\"{[/application],methods=[GET]}\":{\"bean\":\"webEndpointServletHandlerMapping\",\"method\":\"private java.util.Map<java.lang.String, java.util.Map<java.lang.String, org.springframework.boot.actuate.endpoint.web.Link>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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);
|
||||
|
||||
|
||||
@@ -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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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<java.util.Map<java.lang.String, java.lang.Object>> 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);
|
||||
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
// );
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<SpringBootApp> 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.
|
||||
* <p>
|
||||
* 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<LiveRequestMapping> requestMappings = LocalSpringBootApp.parseRequestMappingsJson(mappings, "1.x");
|
||||
when(app.getRequestMappings()).thenReturn(requestMappings);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MockAppBuilder requestMappings(Collection<LiveRequestMapping> 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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<LiveRequestMapping> result = new ArrayList<>();
|
||||
Iterator<String> 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);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user