Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortle2008-09-16 20:29:41 +0000
committertle2008-09-16 20:29:41 +0000
commit07e167554eee883d705333cc262cb3e5353e0444 (patch)
tree2c5635314ae3e6985af386fb3027a46aaa53acc6
parenta4cab0873e21fba1ef428558108fd7ce72d5bfae (diff)
downloadwebtools.dali-07e167554eee883d705333cc262cb3e5353e0444.tar.gz
webtools.dali-07e167554eee883d705333cc262cb3e5353e0444.tar.xz
webtools.dali-07e167554eee883d705333cc262cb3e5353e0444.zip
243362 - Add JPT Persistence library to WTP automatic tests
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java41
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests/test.xml9
2 files changed, 43 insertions, 7 deletions
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java
index f879593cd6..e28af253c4 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/JptCoreTests.java
@@ -9,10 +9,14 @@
******************************************************************************/
package org.eclipse.jpt.core.tests.internal;
+import java.io.File;
+
import junit.framework.Test;
import junit.framework.TestSuite;
+
import org.eclipse.jpt.core.tests.internal.context.JptCoreContextModelTests;
import org.eclipse.jpt.core.tests.internal.model.JptCoreModelTests;
+import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject;
import org.eclipse.jpt.core.tests.internal.resource.JptCoreResourceModelTests;
import org.eclipse.jpt.core.tests.internal.utility.jdt.JptCoreUtilityJdtTests;
@@ -23,23 +27,48 @@ import org.eclipse.jpt.core.tests.internal.utility.jdt.JptCoreUtilityJdtTests;
* until jpa.jar is checked into CVS.
*/
public class JptCoreTests {
+ private static final String JPA_JAR_PROPERTY = TestJpaProject.JAR_NAME_SYSTEM_PROPERTY;
public static Test suite() {
- return suite(false);
+ return suite(true);
}
+ // TODO delete parameter all
public static Test suite(boolean all) {
String quantity = all ? "All" : "Most";
TestSuite suite = new TestSuite(quantity + " JPT Core Tests");
- suite.addTest(JptCoreUtilityJdtTests.suite(all));
- suite.addTest(JptCoreModelTests.suite(all));
- suite.addTest(JptCoreResourceModelTests.suite(all));
- if (all) {
- suite.addTest(JptCoreContextModelTests.suite(all));
+
+ if(jpaJarPropertyExists() && jpaJarFileExists()) {
+ suite.addTest(JptCoreUtilityJdtTests.suite(all));
+ suite.addTest(JptCoreModelTests.suite(all));
+ suite.addTest(JptCoreResourceModelTests.suite(all));
+ if (all) {
+ suite.addTest(JptCoreContextModelTests.suite(all));
+ }
+ }
+ else {
+ String message = ( ! jpaJarPropertyExists()) ?
+ "missing Java system property: \"" + JPA_JAR_PROPERTY + "\"" :
+ "missing JPA jar file: \"" + getJpaJarProperty() + "\"";
+ suite.addTest(TestSuite.warning(message));
}
return suite;
}
+ public static boolean jpaJarPropertyExists() {
+ String jpaJarName = getJpaJarProperty();
+ return jpaJarName != null;
+ }
+
+ public static boolean jpaJarFileExists() {
+ File file = new File(getJpaJarProperty());
+ return file.exists();
+ }
+
+ public static String getJpaJarProperty() {
+ return System.getProperty(JPA_JAR_PROPERTY);
+ }
+
private JptCoreTests() {
super();
throw new UnsupportedOperationException();
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/test.xml b/jpa/tests/org.eclipse.jpt.core.tests/test.xml
index c935ae3aab..00d29665a6 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests/test.xml
+++ b/jpa/tests/org.eclipse.jpt.core.tests/test.xml
@@ -6,6 +6,8 @@
<echo message="eclipse place ${eclipse-home}" />
<!-- sets the properties plugin-name -->
<property name="plugin-name" value="org.eclipse.jpt.core.tests"/>
+ <echo level="debug" message="testRoot: ${testRoot}" />
+ <fail message="testRoot must be set" unless="testRoot" />
<!-- This target holds all initialization code that needs to be done for -->
<!-- all tests that are to be run. Initialization for individual tests -->
@@ -19,11 +21,16 @@
<!-- This target defines the tests that need to be run. -->
<target name="suite">
+ <property file="${testRoot}/testServer.properties"/>
+ <property name="jpt-folder" value="${eclipse-home}/jpt_folder"/>
+ <delete dir="${jpt-folder}" quiet="true"/>
+
<ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${jpt-folder}"/>
<property name="plugin-name" value="${plugin-name}"/>
<property name="classname" value="org.eclipse.jpt.core.tests.internal.JptCoreTests" />
<property name="plugin-path" value="${eclipse-home}/plugins/${plugin-name}"/>
- <property name="extraVMargs" value=""/>
+ <property name="extraVMargs" value="-Dorg.eclipse.jpt.jpa.jar=${testDir}/${jptPersistenceLibDir}"/>
</ant>
</target>

Back to the top