Make the new jdt.ls.extension test run as part of the build

This commit is contained in:
Kris De Volder
2018-05-04 09:14:15 -07:00
parent 689da33d90
commit 5e850fb9fd
5 changed files with 69 additions and 6 deletions

View File

@@ -6,7 +6,7 @@
<groupId>org.springframework.ide.vscode</groupId>
<artifactId>org.springframework.tooling.jdt.ls.commons.test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>org.springframework.tooling.jdt.ls.commons</name>
<name>org.springframework.tooling.jdt.ls.commons.test</name>
<parent>
<groupId>org.springframework.tooling</groupId>
@@ -15,4 +15,44 @@
<relativePath>../pom.xml</relativePath>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<dependency-resolution>
<extraRequirements>
<requirement>
<type>eclipse-feature</type>
<id>org.eclipse.jdt</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
<type>eclipse-feature</type>
<id>org.eclipse.platform</id>
<versionRange>0.0.0</versionRange>
</requirement>
<requirement>
<type>eclipse-feature</type>
<id>org.eclipse.rcp</id>
<versionRange>0.0.0</versionRange>
</requirement>
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<forkedProcessTimeoutInSeconds>200</forkedProcessTimeoutInSeconds>
<includes>**/*Test.java</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -30,10 +30,13 @@ import org.eclipse.jdt.core.JavaCore;
import org.junit.After;
import org.junit.Test;
import org.springframework.tooling.jdt.ls.commons.classpath.Classpath;
import org.springframework.tooling.jdt.ls.commons.classpath.Classpath.CPE;
import org.springframework.tooling.jdt.ls.commons.classpath.ClientCommandExecutor;
import org.springframework.tooling.jdt.ls.commons.classpath.ReusableClasspathListenerHandler;
import org.springsource.ide.eclipse.commons.frameworks.test.util.ACondition;
import junit.framework.AssertionFailedError;
public class ClasspathListenerHandlerTest {
static class Info {
@@ -99,10 +102,21 @@ public class ClasspathListenerHandlerTest {
ACondition.waitFor("Project with classpath to appear", Duration.ofSeconds(5), () -> {
Classpath cp = classpaths.getFor(project).classpath;
assertTrue(cp.getEntries().stream().filter(cpe -> Classpath.isSource(cpe)).count()==1); //has 1 source entry
assertTrue(cp.getEntries().stream().filter(cpe -> Classpath.isBinary(cpe) && cpe.isSystem()).count()>=1); //has some system libraries
assertClasspath(cp, cp.getEntries().stream().filter(cpe -> Classpath.isBinary(cpe) && cpe.isSystem()).count()>=1); //has some system libraries
});
}
private static void assertClasspath(Classpath cp, boolean b) {
if (!b) {
StringBuilder buf = new StringBuilder();
for (CPE cpe : cp.getEntries()) {
buf.append("\n ");
buf.append(cpe);
}
throw new AssertionFailedError("Unexpected classpath:" + buf);
}
}
private IProject createTestProject(String name) throws Exception {
File testProjectLocation = new File(FileLocator.toFileURL(Platform.getBundle("org.springframework.tooling.jdt.ls.commons.test").getEntry("test-projects/"+name)).toURI());
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);

View File

@@ -128,8 +128,11 @@ public class Classpath {
@Override
public String toString() {
return "CPE [kind=" + kind + ", path=" + path + "]";
return "CPE [kind=" + kind + ", isSystem=" + isSystem + ", path=" + path + ", outputFolder=" + outputFolder
+ ", sourceContainerUrl=" + sourceContainerUrl + ", javadocContainerUrl=" + javadocContainerUrl
+ "]";
}
}
public static boolean isSource(CPE e) {

View File

@@ -69,12 +69,18 @@
"description": "Enable/Disable Spring running Boot application live hints decorators in Java source code"
},
"spring-boot.ls.java.home": {
"type": ["string", null],
"type": [
"string",
null
],
"default": null,
"description": "Override JAVA_HOME used for launching the spring-boot-language-server JVM process."
},
"spring-boot.ls.java.heap": {
"type": ["string", null],
"type": [
"string",
null
],
"default": null,
"description": "Max JVM heap value, passed via -Xmx argument when launching spring-boot-language-server JVM process."
}

View File

@@ -17,7 +17,7 @@ mkdir -p ${workdir}/jars
# Use maven to build jdt ls extension
cd ../../headless-services/jdt-ls-extension
../mvnw clean package
../mvnw clean integration-test
cp org.springframework.tooling.jdt.ls.extension/target/*.jar ${workdir}/jars/jdt-ls-extension.jar
cp org.springframework.tooling.jdt.ls.commons/target/*.jar ${workdir}/jars/jdt-ls-commons.jar