Author: scabanovich
Date: 2011-10-14 16:32:42 -0400 (Fri, 14 Oct 2011)
New Revision: 35678
Added:
trunk/common/tests/org.jboss.tools.common.model.test/.settings/
trunk/common/tests/org.jboss.tools.common.model.test/.settings/org.eclipse.jdt.core.prefs
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test4/
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test4/.classpath
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test4/.project
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test4/src/
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test5/
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test5/.classpath
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test5/.project
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test5/src/
Modified:
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test1/.classpath
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/ClassPathTest.java
Log:
JBIDE-9906
https://issues.jboss.org/browse/JBIDE-9906
Jars exported by parent projects are taken into account.
Added:
trunk/common/tests/org.jboss.tools.common.model.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.test/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.test/.settings/org.eclipse.jdt.core.prefs 2011-10-14
20:32:42 UTC (rev 35678)
@@ -0,0 +1,8 @@
+#Fri Sep 30 12:13:48 PDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.test/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/common/tests/org.jboss.tools.common.model.test/projects/Test1/.classpath
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test1/.classpath 2011-10-14
20:30:20 UTC (rev 35677)
+++
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test1/.classpath 2011-10-14
20:32:42 UTC (rev 35678)
@@ -2,6 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="lib/a.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/a.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Added: trunk/common/tests/org.jboss.tools.common.model.test/projects/Test4/.classpath
===================================================================
--- trunk/common/tests/org.jboss.tools.common.model.test/projects/Test4/.classpath
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test4/.classpath 2011-10-14
20:32:42 UTC (rev 35678)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" exported="true"
kind="src" path="/Test1"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test4/.classpath
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/common/tests/org.jboss.tools.common.model.test/projects/Test4/.project
===================================================================
--- trunk/common/tests/org.jboss.tools.common.model.test/projects/Test4/.project
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test4/.project 2011-10-14
20:32:42 UTC (rev 35678)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Test4</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test4/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/common/tests/org.jboss.tools.common.model.test/projects/Test5/.classpath
===================================================================
--- trunk/common/tests/org.jboss.tools.common.model.test/projects/Test5/.classpath
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test5/.classpath 2011-10-14
20:32:42 UTC (rev 35678)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src"
path="/Test4"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test5/.classpath
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/common/tests/org.jboss.tools.common.model.test/projects/Test5/.project
===================================================================
--- trunk/common/tests/org.jboss.tools.common.model.test/projects/Test5/.project
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test5/.project 2011-10-14
20:32:42 UTC (rev 35678)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Test5</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test5/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-14
20:30:20 UTC (rev 35677)
+++
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/ClassPathTest.java 2011-10-14
20:32:42 UTC (rev 35678)
@@ -3,7 +3,7 @@
import java.io.File;
import java.io.IOException;
import java.net.URL;
-import java.util.List;
+import java.util.Collection;
import junit.framework.TestCase;
@@ -27,12 +27,14 @@
import org.osgi.framework.Bundle;
/**
- * Automatic test for JBIDE-1811.
- * Checks that EclipseResourceUtil.getClassPath(IProject)
+ * Automatic test for JBIDE-1811 & 9906.
+ * Checks that EclipseResourceUtil.getAllVisibleLibraries(IProject)
* returns list which includes paths for Eclipse class path entries:
* 1. jars from the same project;
* 2. jars from another project in Eclipse work space;
* 3. external jars.
+ * 4. exported jars from a parent project
+ * 5. exported jars from a project exported by parent project
*
* @author V.Kabanovich
*
@@ -43,6 +45,10 @@
IProject project1 = null;
TestProjectProvider provider2 = null;
IProject project2 = null;
+ TestProjectProvider provider4 = null;
+ IProject project4 = null;
+ TestProjectProvider provider5 = null;
+ IProject project5 = null;
public ClassPathTest() {}
@@ -53,8 +59,16 @@
provider2 = new TestProjectProvider(BUNDLE_NAME, null, "Test2", true);
project2 = provider2.getProject();
+ provider4 = new TestProjectProvider(BUNDLE_NAME, null, "Test4", true);
+ project4 = provider4.getProject();
+
+ provider5 = new TestProjectProvider(BUNDLE_NAME, null, "Test5", true);
+ project5 = provider5.getProject();
+
project1.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
project2.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ project4.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ project5.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
JobUtils.waitForIdle();
@@ -95,17 +109,26 @@
}
public void testGetClassPath() throws CoreException, IOException {
- List<String> list = EclipseResourceUtil.getClassPath(project2);
+ Collection<String> list = EclipseResourceUtil.getAllVisibleLibraries(project2);
String[] testNames = {
"/Test2/lib/b.jar", //1. jar from this project
"/Test1/lib/a.jar", //2. jar from another project
- "/Test3/lib/c.jar" //3. external jar
+ "/Test3/lib/c.jar" //3. external jar
};
for (int i = 0; i < testNames.length; i++) {
assertTrue("Cannot find classpath entry " + testNames[i], contains(list,
testNames[i]));
}
+ //4. exported jars from a parent project
+ String testName = "/Test1/lib/a.jar";
+ list = EclipseResourceUtil.getAllVisibleLibraries(project4);
+ assertTrue("Cannot find classpath entry " + testName, contains(list,
testName));
+
+ //5. exported jars from a project exported by parent project
+ testName = "/Test1/lib/a.jar";
+ list = EclipseResourceUtil.getAllVisibleLibraries(project5);
+ assertTrue("Cannot find classpath entry " + testName, contains(list,
testName));
}
private String getLocation(String relativeInBundle) throws IOException {
@@ -116,11 +139,13 @@
}
public void tearDown() {
+ provider5.dispose();
+ provider4.dispose();
provider2.dispose();
provider1.dispose();
}
- private boolean contains(List<String> list, String name) {
+ private boolean contains(Collection<String> list, String name) {
for (String s: list) {
if(s.replace('\\', '/').endsWith(name.replace('\\',
'/'))) {
return true;