use of org.eclipse.xtext.ui.testing.util.JavaProjectSetupUtil.TextFile in project xtext-eclipse by eclipse.
the class IntegrationTest method testFullBuild.
@Test
public void testFullBuild() throws Exception {
IJavaProject project = createJavaProject("foo");
addNature(project.getProject(), XtextProjectHelper.NATURE_ID);
IProject someProject = createProject("bar");
IFile file = someProject.getFile("foo.jar");
file.create(jarInputStream(new TextFile("foo/Bar" + F_EXT, "object Foo")), true, monitor());
assertEquals(0, countResourcesInIndex());
addJarToClasspath(project, file);
assertEquals(1, countResourcesInIndex());
getBuilderState().addListener(this);
fullBuild();
assertEquals(1, countResourcesInIndex());
assertEquals(1, getEvents().size());
}
use of org.eclipse.xtext.ui.testing.util.JavaProjectSetupUtil.TextFile in project xtext-eclipse by eclipse.
the class SimpleProjectsIntegrationTest method testEvents.
@Test
public void testEvents() throws Exception {
IJavaProject xtextProject = createJavaProject("xtextProject");
addNature(xtextProject.getProject(), XtextProjectHelper.NATURE_ID);
IProject projectWithJarFile = createProject("projectWithJar");
IFile jarFile = projectWithJarFile.getFile("jarFile.jar");
jarFile.create(JavaProjectSetupUtil.jarInputStream(new TextFile("inJar/Bar" + F_EXT, "object InJar")), true, monitor());
jarFile.setLocalTimeStamp(100L);
addJarToClasspath(xtextProject, jarFile);
projectWithJarFile.delete(true, monitor());
build();
assertEmptyIndex();
}
use of org.eclipse.xtext.ui.testing.util.JavaProjectSetupUtil.TextFile in project xtext-eclipse by eclipse.
the class SimpleProjectsIntegrationTest method testNewlyAddedReexportedSource.
@Test
public void testNewlyAddedReexportedSource() throws Exception {
IJavaProject foo = createJavaProject("foo");
IJavaProject bar = createJavaProject("bar");
IJavaProject baz = createJavaProject("baz");
addNature(foo.getProject(), XtextProjectHelper.NATURE_ID);
addNature(bar.getProject(), XtextProjectHelper.NATURE_ID);
addNature(baz.getProject(), XtextProjectHelper.NATURE_ID);
addToClasspath(bar, JavaCore.newProjectEntry(foo.getPath(), true));
addToClasspath(baz, JavaCore.newProjectEntry(bar.getPath(), false));
addSourceFolder(baz, "src");
IFile bazFile = createFile("baz/src/Baz" + F_EXT, "object Baz references Foo");
build();
assertEquals(1, countMarkers(bazFile));
IFile file = foo.getProject().getFile("foo.jar");
file.create(JavaProjectSetupUtil.jarInputStream(new TextFile("foo/Foo" + F_EXT, "object Foo")), true, monitor());
IClasspathEntry newLibraryEntry = JavaCore.newLibraryEntry(file.getFullPath(), null, null, true);
addToClasspath(foo, newLibraryEntry);
build();
assertEquals(0, countMarkers(bazFile));
}
use of org.eclipse.xtext.ui.testing.util.JavaProjectSetupUtil.TextFile in project xtext-eclipse by eclipse.
the class Storage2UriMapperJdtImplTest method testBug463258_03a.
@Test
public void testBug463258_03a() throws Exception {
IJavaProject project = createJavaProject("foo");
IFile file = project.getProject().getFile("foo.jar");
file.create(jarInputStream(new TextFile("foo/bar.notindexed", "//empty")), true, monitor());
addJarToClasspath(project, file);
Storage2UriMapperJavaImpl impl = getStorage2UriMapper();
IPackageFragmentRoot root = project.getPackageFragmentRoot(file);
IPackageFragment foo = root.getPackageFragment("foo");
JarEntryFile fileInJar = new JarEntryFile("bar.notindexed");
fileInJar.setParent(foo);
File jarFile = file.getRawLocation().toFile();
assertTrue("exists", jarFile.exists());
assertTrue("delete", jarFile.delete());
URI uri = impl.getUri(fileInJar);
assertEquals("archive:platform:/resource/foo/foo.jar!/foo/bar.notindexed", uri.toString());
}
use of org.eclipse.xtext.ui.testing.util.JavaProjectSetupUtil.TextFile in project xtext-eclipse by eclipse.
the class Storage2UriMapperJdtImplTest method testBug463258_02.
@Test
public void testBug463258_02() throws Exception {
IJavaProject project = createJavaProject("foo");
IFile file = project.getProject().getFile("foo.jar");
file.create(jarInputStream(new TextFile("do/not", "care")), true, monitor());
addJarToClasspath(project, file);
Storage2UriMapperJavaImpl impl = getStorage2UriMapper();
IPackageFragmentRoot root = project.getPackageFragmentRoot(file);
IPackageFragment foo = root.getPackageFragment("unknown");
JarEntryFile fileInJar = new JarEntryFile("doesNotExist.notindexed");
fileInJar.setParent(foo);
URI uri = impl.getUri(fileInJar);
assertEquals("archive:platform:/resource/foo/foo.jar!/unknown/doesNotExist.notindexed", uri.toString());
}
Aggregations