Search in sources :

Example 16 with JarEntry

use of org.eclipse.che.ide.ext.java.shared.JarEntry in project che by eclipse.

the class JarNavigationTest method testDoNotIncludeDefaultEmptyPackage.

@Test
public void testDoNotIncludeDefaultEmptyPackage() throws Exception {
    String javaHome = System.getProperty("java.home") + "/lib/ext/zipfs.jar";
    IPackageFragmentRoot root = project.getPackageFragmentRoot(new File(javaHome).getPath());
    List<JarEntry> rootContent = navigation.getPackageFragmentRootContent(project, root.hashCode());
    assertThat(rootContent).isNotNull().isNotEmpty().onProperty("name").excludes("(default package)");
    assertThat(rootContent).onProperty("path").contains("/META-INF");
}
Also used : JarEntry(org.eclipse.che.ide.ext.java.shared.JarEntry) File(java.io.File) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot) Test(org.junit.Test)

Example 17 with JarEntry

use of org.eclipse.che.ide.ext.java.shared.JarEntry in project che by eclipse.

the class JarNavigationTest method testClassFileFQN.

@Test
public void testClassFileFQN() throws Exception {
    String javaHome = System.getProperty("java.home") + "/lib/rt.jar";
    IPackageFragmentRoot root = project.getPackageFragmentRoot(new File(javaHome).getPath());
    List<JarEntry> rootContent = navigation.getChildren(project, root.hashCode(), "java.lang");
    assertThat(rootContent).isNotNull().isNotEmpty().onProperty("path").contains("java.lang.Object", "java.lang.String", "java.lang.Integer");
}
Also used : JarEntry(org.eclipse.che.ide.ext.java.shared.JarEntry) File(java.io.File) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot) Test(org.junit.Test)

Example 18 with JarEntry

use of org.eclipse.che.ide.ext.java.shared.JarEntry in project che by eclipse.

the class JarNavigationTest method testNonJavaElement.

@Test
public void testNonJavaElement() throws Exception {
    String javaHome = System.getProperty("java.home") + "/lib/ext/zipfs.jar";
    IPackageFragmentRoot root = project.getPackageFragmentRoot(new File(javaHome).getPath());
    List<JarEntry> rootContent = navigation.getPackageFragmentRootContent(project, root.hashCode());
    assertThat(rootContent).isNotNull().isNotEmpty().onProperty("name").contains("META-INF");
    assertThat(rootContent).onProperty("path").contains("/META-INF");
}
Also used : JarEntry(org.eclipse.che.ide.ext.java.shared.JarEntry) File(java.io.File) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot) Test(org.junit.Test)

Example 19 with JarEntry

use of org.eclipse.che.ide.ext.java.shared.JarEntry in project che by eclipse.

the class JarNavigationTest method testSortJarEntriesWithClasses.

@Test
public void testSortJarEntriesWithClasses() throws Exception {
    String javaHome = getClass().getResource("/temp").getPath() + "/ws/test/gwt-user.jar";
    IPackageFragmentRoot root = project.getPackageFragmentRoot(new File(javaHome).getPath());
    List<JarEntry> content = navigation.getChildren(project, root.hashCode(), "org.hibernate.validator");
    assertThat(content).isNotNull().isNotEmpty().onProperty("name").containsSequence("engine", "HibernateValidationMessageResolver.class", "ValidationMessages.class", "HibernateValidator.gwt.xml", "README.txt");
}
Also used : JarEntry(org.eclipse.che.ide.ext.java.shared.JarEntry) File(java.io.File) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot) Test(org.junit.Test)

Example 20 with JarEntry

use of org.eclipse.che.ide.ext.java.shared.JarEntry in project che by eclipse.

the class JarNavigationTest method testDoesNotReturnInnerClasses.

@Test
public void testDoesNotReturnInnerClasses() throws Exception {
    String javaHome = System.getProperty("java.home") + "/lib/rt.jar";
    IPackageFragmentRoot root = project.getPackageFragmentRoot(new File(javaHome).getPath());
    List<JarEntry> rootContent = navigation.getChildren(project, root.hashCode(), "java.lang");
    assertThat(rootContent).isNotNull().isNotEmpty().onProperty("name").excludes("Character$Subset.class");
}
Also used : JarEntry(org.eclipse.che.ide.ext.java.shared.JarEntry) File(java.io.File) IPackageFragmentRoot(org.eclipse.jdt.core.IPackageFragmentRoot) Test(org.junit.Test)

Aggregations

JarEntry (org.eclipse.che.ide.ext.java.shared.JarEntry)23 IPackageFragmentRoot (org.eclipse.jdt.core.IPackageFragmentRoot)16 File (java.io.File)15 Test (org.junit.Test)15 Operation (org.eclipse.che.api.promises.client.Operation)4 OperationException (org.eclipse.che.api.promises.client.OperationException)4 VirtualFile (org.eclipse.che.ide.api.resources.VirtualFile)4 Optional (com.google.common.base.Optional)3 Scheduler (com.google.gwt.core.client.Scheduler)3 EditorPartPresenter (org.eclipse.che.ide.api.editor.EditorPartPresenter)3 OpenEditorCallbackImpl (org.eclipse.che.ide.api.editor.OpenEditorCallbackImpl)3 File (org.eclipse.che.ide.api.resources.File)3 ClassContent (org.eclipse.che.ide.ext.java.shared.dto.ClassContent)3 Project (org.eclipse.che.ide.api.resources.Project)2 Resource (org.eclipse.che.ide.api.resources.Resource)2 SyntheticFile (org.eclipse.che.ide.api.resources.SyntheticFile)2 IClassFile (org.eclipse.jdt.core.IClassFile)2 JarEntryDirectory (org.eclipse.jdt.internal.core.JarEntryDirectory)2 JarEntryFile (org.eclipse.jdt.internal.core.JarEntryFile)2 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1