use of org.springframework.ide.vscode.commons.maven.java.MavenJavaProject in project sts4 by spring-projects.
the class HtmlJavadocTest method html_testNoJavadocClass.
@Test
public void html_testNoJavadocClass() throws Exception {
MavenJavaProject project = projectSupplier.get();
;
IType type = project.getClasspath().findType("hello.GreetingController");
assertNotNull(type);
assertNull(type.getJavaDoc());
}
use of org.springframework.ide.vscode.commons.maven.java.MavenJavaProject in project sts4 by spring-projects.
the class JavaIndexTest method findClassInJar.
@Test
public void findClassInJar() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("gs-rest-service-cors-boot-1.4.1-with-classpath-file");
IType type = project.getClasspath().findType("org.springframework.test.web.client.ExpectedCount");
assertNotNull(type);
}
use of org.springframework.ide.vscode.commons.maven.java.MavenJavaProject in project sts4 by spring-projects.
the class JavaIndexTest method voidConstructor.
@Test
public void voidConstructor() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("gs-rest-service-cors-boot-1.4.1-with-classpath-file");
IType type = project.getClasspath().findType("java.util.ArrayList");
assertNotNull(type);
IMethod m = type.getMethod("<init>", Stream.empty());
assertEquals(type.getElementName(), m.getElementName());
assertEquals(IVoidType.DEFAULT, m.getReturnType());
assertEquals(0, m.parameters().count());
}
use of org.springframework.ide.vscode.commons.maven.java.MavenJavaProject in project sts4 by spring-projects.
the class JavaIndexTest method constructorMethodWithParams.
@Test
public void constructorMethodWithParams() throws Exception {
MavenJavaProject project = mavenProjectsCache.get("gs-rest-service-cors-boot-1.4.1-with-classpath-file");
IType type = project.getClasspath().findType("java.util.ArrayList");
assertNotNull(type);
IMethod m = type.getMethod("<init>", Stream.of(IPrimitiveType.INT));
assertEquals(m.getDeclaringType().getElementName(), m.getElementName());
assertEquals(IVoidType.DEFAULT, m.getReturnType());
assertEquals(Collections.singletonList(IPrimitiveType.INT), m.parameters().collect(Collectors.toList()));
}
use of org.springframework.ide.vscode.commons.maven.java.MavenJavaProject in project sts4 by spring-projects.
the class MavenProjectCacheTest method testPomFileChanges.
@Test
public void testPomFileChanges() throws Exception {
MavenProjectCache cache = new MavenProjectCache(server, MavenCore.getDefault(), false, null);
IJavaProject[] projectChanged = new IJavaProject[] { null };
IJavaProject[] projectDeleted = new IJavaProject[] { null };
cache.addListener(new Listener() {
@Override
public void created(IJavaProject project) {
}
@Override
public void changed(IJavaProject project) {
projectChanged[0] = project;
}
@Override
public void deleted(IJavaProject project) {
projectDeleted[0] = project;
}
});
// Get the project from cache
MavenJavaProject cachedProject = cache.project(pomFile);
assertNotNull(cachedProject);
ImmutableList<Path> calculatedClassPath = cachedProject.getClasspath().getClasspathEntries();
assertEquals(48, calculatedClassPath.size());
fileObserver.notifyFileChanged(pomFile.toURI().toString());
assertNull(projectChanged[0]);
writeContent(pomFile, new String(Files.readAllBytes(testProjectPath.resolve("pom.newxml")), Charset.defaultCharset()));
fileObserver.notifyFileChanged(pomFile.toURI().toString());
assertNotNull(projectChanged[0]);
assertEquals(cachedProject, projectChanged[0]);
calculatedClassPath = cachedProject.getClasspath().getClasspathEntries();
assertEquals(49, calculatedClassPath.size());
fileObserver.notifyFileDeleted(pomFile.toURI().toString());
assertEquals(cachedProject, projectDeleted[0]);
}
Aggregations