Author: dgolovin
Date: 2010-05-27 15:14:32 -0400 (Thu, 27 May 2010)
New Revision: 22390
Added:
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test3/
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test3/lib/
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test3/lib/c.jar
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/util/
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/util/test/
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/util/test/PathsTest.java
Modified:
trunk/common/tests/org.jboss.tools.common.model.test/pom.xml
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.ui.test/pom.xml
Log:
https://jira.jboss.org/browse/JBDS-1202 problems running tests
unpacking is not required anymore for mode.test and model.ui.test plug-ins
Modified: trunk/common/tests/org.jboss.tools.common.model.test/pom.xml
===================================================================
--- trunk/common/tests/org.jboss.tools.common.model.test/pom.xml 2010-05-27 18:47:18 UTC
(rev 22389)
+++ trunk/common/tests/org.jboss.tools.common.model.test/pom.xml 2010-05-27 19:14:32 UTC
(rev 22390)
@@ -12,18 +12,4 @@
<artifactId>org.jboss.tools.common.model.test</artifactId>
<version>3.1.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.sonatype.tycho</groupId>
- <artifactId>maven-osgi-test-plugin</artifactId>
- <configuration>
- <explodedBundles>
- <bundle>org.jboss.tools.common.model.test</bundle>
- </explodedBundles>
- </configuration>
- </plugin>
- </plugins>
- </build>
</project>
Added: trunk/common/tests/org.jboss.tools.common.model.test/projects/Test3/lib/c.jar
===================================================================
(Binary files differ)
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.test/projects/Test3/lib/c.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
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 2010-05-27
18:47:18 UTC (rev 22389)
+++
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/test/ClassPathTest.java 2010-05-27
19:14:32 UTC (rev 22390)
@@ -9,6 +9,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
@@ -58,7 +59,10 @@
IJavaProject jp = JavaCore.create(project2);
IClasspathEntry[] es = jp.getRawClasspath();
- String location = getLocation("projects/c.jar");
+ TestProjectProvider provider3 = new TestProjectProvider(BUNDLE_NAME, null,
"Test3", true);
+ provider3.getProject();
+
+ String location = ResourcesPlugin.getWorkspace().getRoot().getFile(new
Path("/Test3/lib/c.jar")).getLocation().toFile().getAbsolutePath();
assertTrue("Cannot find file " + location, new File(location).isFile());
IPath path = new Path(location);
@@ -79,7 +83,7 @@
String[] testNames = {
"/Test2/lib/b.jar", //1. jar from this project
"/Test1/lib/a.jar", //2. jar from another project
- "/projects/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]));
Added:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/util/test/PathsTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/util/test/PathsTest.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/util/test/PathsTest.java 2010-05-27
19:14:32 UTC (rev 22390)
@@ -0,0 +1,91 @@
+package org.jboss.tools.common.model.util.test;
+
+import java.util.Properties;
+
+import org.jboss.tools.common.model.util.Paths;
+
+import junit.framework.TestCase;
+
+public class PathsTest extends TestCase {
+ static Properties p = new Properties();
+ static {
+ p.put("p1","pvalue1");
+ p.put("p2","pvalue2");
+ p.put("p3","pvalue3");
+ p.put("p4","pvalue4");
+ }
+
+ public void testExpandNothingToExpand() {
+ final String value =
+ "Value for p1 is p1\n" +
+ "Value for p2 is p2\n" +
+ "Value for p3 is p3\n" +
+ "Value for p4 is p4\n" +
+ "No more values";
+ String actual = Paths.expand(value, p);
+ assertEquals(value, actual);
+ }
+
+ public void testExpandMultipleCorrectVars() {
+ final String value =
+ "Value for p1 is %p1%\n" +
+ "Value for p2 is %p2%\n" +
+ "Value for p3 is %p3%\n" +
+ "Value for p4 is %p4%\n" +
+ "No more values";
+ String actual = Paths.expand(value, p);
+ String expected = value.replace("%p1%", p.getProperty("p1"));
+ expected = expected.replace("%p2%", p.getProperty("p2"));
+ expected = expected.replace("%p3%", p.getProperty("p3"));
+ expected = expected.replace("%p4%", p.getProperty("p4"));
+ assertEquals(expected, actual);
+ }
+
+ public void testExpandMultipleCorrectVarsStartsFromVariable() {
+ final String value =
+ "%p1%\n" +
+ "Value for p2 is %p2%\n" +
+ "Value for p3 is %p3%\n" +
+ "Value for p4 is %p4%" +
+ "No more values";
+ String actual = Paths.expand(value, p);
+ String expected = value.replace("%p1%", p.getProperty("p1"));
+ expected = expected.replace("%p2%", p.getProperty("p2"));
+ expected = expected.replace("%p3%", p.getProperty("p3"));
+ expected = expected.replace("%p4%", p.getProperty("p4"));
+ assertEquals(expected, actual);
+ }
+
+ public void testExpandMultipleCorrectVarsNoTextOnlyVars() {
+ final String value =
+ "%p1%%p2%%p3%%p4%";
+ String actual = Paths.expand(value, p);
+ String expected = value.replace("%p1%", p.getProperty("p1"));
+ expected = expected.replace("%p2%", p.getProperty("p2"));
+ expected = expected.replace("%p3%", p.getProperty("p3"));
+ expected = expected.replace("%p4%", p.getProperty("p4"));
+ assertEquals(expected, actual);
+ }
+
+ public void testExpandMultipleVarsWithClosingVarError() {
+ final String value =
+ "%p1% %p2% %p3% %p4";
+ String actual = Paths.expand(value, p);
+ String expected = value.replace("%p1%", p.getProperty("p1"));
+ expected = expected.replace("%p2%", p.getProperty("p2"));
+ expected = expected.replace("%p3%", p.getProperty("p3"));
+ expected = expected.replace("%p4%", p.getProperty("p4"));
+ assertEquals(expected, actual);
+ }
+
+ public void testExpandMultipleVarsWithSpaceInVarError() {
+ final String value =
+ "%p1 % %p2% %p3% %p4";
+ String actual = Paths.expand(value, p);
+ String expected = value.replace("%p1%", p.getProperty("p1"));
+ expected = expected.replace("%p2%", p.getProperty("p2"));
+ expected = expected.replace("%p3%", p.getProperty("p3"));
+ expected = expected.replace("%p4%", p.getProperty("p4"));
+ assertEquals(expected, actual);
+ }
+}
Property changes on:
trunk/common/tests/org.jboss.tools.common.model.test/src/org/jboss/tools/common/model/util/test/PathsTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/common/tests/org.jboss.tools.common.model.ui.test/pom.xml
===================================================================
--- trunk/common/tests/org.jboss.tools.common.model.ui.test/pom.xml 2010-05-27 18:47:18
UTC (rev 22389)
+++ trunk/common/tests/org.jboss.tools.common.model.ui.test/pom.xml 2010-05-27 19:14:32
UTC (rev 22390)
@@ -12,18 +12,4 @@
<artifactId>org.jboss.tools.common.model.ui.test</artifactId>
<version>3.1.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.sonatype.tycho</groupId>
- <artifactId>maven-osgi-test-plugin</artifactId>
- <configuration>
- <explodedBundles>
- <bundle>org.jboss.tools.common.model.ui.test</bundle>
- </explodedBundles>
- </configuration>
- </plugin>
- </plugins>
- </build>
</project>