Make the new jdt.ls.extension test run as part of the build
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user