Author: scabanovich
Date: 2011-10-11 16:43:15 -0400 (Tue, 11 Oct 2011)
New Revision: 35559
Modified:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/ClassPathTest.java
Log:
JBIDE-9884
https://issues.jboss.org/browse/JBIDE-9884
Test added that for jar shared by several projects: (1) jar handles are different; (2)
children are same objects; (3) hasChildren() is correct.
Modified:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/ClassPathTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/ClassPathTest.java 2011-10-11
20:41:00 UTC (rev 35558)
+++
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/ClassPathTest.java 2011-10-11
20:43:15 UTC (rev 35559)
@@ -19,6 +19,8 @@
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.TestProjectProvider;
@@ -77,6 +79,21 @@
JobUtils.waitForIdle();
}
+ public void testSharingJarContent() throws Exception {
+ XModelObject fs1 = EclipseResourceUtil.createObjectForResource(project1);
+ XModelObject fs2 = EclipseResourceUtil.createObjectForResource(project2);
+
+ XModelObject a1 = FileSystemsHelper.getFileSystem(fs1.getModel(),
"lib-a.jar");
+ XModelObject a2 = FileSystemsHelper.getFileSystem(fs2.getModel(),
"lib-a.jar");
+ assertTrue(a1.hasChildren());
+ assertTrue(a2.hasChildren());
+ assertFalse(a1 == a2);
+ XModelObject[] c1 = a1.getChildren();
+ XModelObject[] c2 = a2.getChildren();
+ assertTrue(c1[0] == c2[0]);
+ System.out.println(a1.toString() + a2.toString());
+ }
+
public void testGetClassPath() throws CoreException, IOException {
List<String> list = EclipseResourceUtil.getClassPath(project2);
@@ -98,6 +115,11 @@
return location;
}
+ public void tearDown() {
+ provider2.dispose();
+ provider1.dispose();
+ }
+
private boolean contains(List<String> list, String name) {
for (String s: list) {
if(s.replace('\\', '/').endsWith(name.replace('\\',
'/'))) {