Author: aadamchik
Date: Thu Aug 10 18:43:50 2006
New Revision: 430615

URL: http://svn.apache.org/viewvc?rev=430615&view=rev
Log:
created a portable integration test setup with one common module and dependent 
individual test modules

Added:
    
incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/Unit1TestCase.java
    
incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/resources/unit1-schema-hsqldb.sql
      - copied unchanged from r430553, 
incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/resources/schema-hsqldb.sql
Removed:
    
incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/resources/schema-hsqldb.sql
Modified:
    incubator/cayenne/main/trunk/integration-test/jpa-unit1/.project
    incubator/cayenne/main/trunk/integration-test/jpa-unit1/pom.xml
    
incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/EntityClassTest.java

Modified: incubator/cayenne/main/trunk/integration-test/jpa-unit1/.project
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/jpa-unit1/.project?rev=430615&r1=430614&r2=430615&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/integration-test/jpa-unit1/.project (original)
+++ incubator/cayenne/main/trunk/integration-test/jpa-unit1/.project Thu Aug 10 
18:43:50 2006
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-       <name>itest-unit1</name>
+       <name>jpa-unit1</name>
        <comment></comment>
        <projects>
        </projects>

Modified: incubator/cayenne/main/trunk/integration-test/jpa-unit1/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/jpa-unit1/pom.xml?rev=430615&r1=430614&r2=430615&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/integration-test/jpa-unit1/pom.xml (original)
+++ incubator/cayenne/main/trunk/integration-test/jpa-unit1/pom.xml Thu Aug 10 
18:43:50 2006
@@ -5,13 +5,13 @@
        <modelVersion>4.0.0</modelVersion>
 
        <parent>
-               <groupId>org.apache.cayenne.core.</groupId>
-               <artifactId>cayenne-core-parent</artifactId>
+               <groupId>org.apache.cayenne.itest</groupId>
+               <artifactId>cayenne-itest-parent</artifactId>
                <version>3.0-incubating-SNAPSHOT</version>
        </parent>
 
-       <description>Cayenne JPA Implementation</description>
-       <artifactId>itest-unit1</artifactId>
+       <description>Cayenne JPA Integration Tests</description>
+       <artifactId>jpa-unit1</artifactId>
        <name>Cayenne JPA Integration Tests - Persistence Unit 1</name>
        <packaging>jar</packaging>
 
@@ -22,8 +22,8 @@
                </dependency>
 
                <dependency>
-                       <groupId>org.apache.cayenne.core</groupId>
-                       <artifactId>itest-provider</artifactId>
+                       <groupId>org.apache.cayenne.itest</groupId>
+                       <artifactId>itest-common</artifactId>
                        <version>${version}</version>
                </dependency>
 

Modified: 
incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/EntityClassTest.java
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/EntityClassTest.java?rev=430615&r1=430614&r2=430615&view=diff
==============================================================================
--- 
incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/EntityClassTest.java
 (original)
+++ 
incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/EntityClassTest.java
 Thu Aug 10 18:43:50 2006
@@ -20,60 +20,34 @@
 
 import javax.persistence.EntityManager;
 
-import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-
-import org.apache.cayenne.jpa.itest.Unit1TestSetup;
-import org.apache.cayenne.jpa.itest.UnitTestDBUtils;
+import org.apache.cayenne.jpa.itest.ItestDBUtils;
+import org.apache.cayenne.jpa.itest.ItestSetup;
 import org.apache.cayenne.jpa.itest1.entity.FieldPersistenceEntity;
 import org.apache.cayenne.jpa.itest1.entity.PropertyPersistenceEntity;
 
-public class EntityClassTest extends TestCase {
+public class EntityClassTest extends Unit1TestCase {
 
     public void testFieldBasedPersistence() throws Exception {
 
-        UnitTestDBUtils.deleteAll("FieldPersistenceEntity");
+        ItestDBUtils.deleteAll("FieldPersistenceEntity");
 
-        EntityManager em = Unit1TestSetup.getInstance().createEntityManager();
+        EntityManager em = ItestSetup.getInstance().createEntityManager();
 
         FieldPersistenceEntity o1 = new FieldPersistenceEntity();
         em.persist(o1);
         em.flush();
 
-        assertEquals(FieldPersistenceEntity.INITIAL_VALUE, UnitTestDBUtils
-                .getSingleValue("FieldPersistenceEntity", "property1"));
+        assertEquals(FieldPersistenceEntity.INITIAL_VALUE, 
ItestDBUtils.getSingleValue(
+                "FieldPersistenceEntity",
+                "property1"));
     }
 
     public void testPropertyBasedPersistence() {
 
-        EntityManager em = Unit1TestSetup.getInstance().createEntityManager();
+        EntityManager em = ItestSetup.getInstance().createEntityManager();
 
         PropertyPersistenceEntity o1 = new PropertyPersistenceEntity();
         em.persist(o1);
         em.flush();
     }
-
-    public static void main(String[] args) {
-
-        try {
-            new EntityClassTest().testFieldBasedPersistence();
-        }
-        catch (AssertionFailedError e) {
-            System.out.print("FAILURE: " + e.getMessage());
-        }
-        catch (Exception e) {
-            e.printStackTrace();
-        }
-
-        try {
-            new EntityClassTest().testPropertyBasedPersistence();
-        }
-        catch (AssertionFailedError e) {
-            System.out.print("FAILURE: " + e.getMessage());
-        }
-        catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
 }

Added: 
incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/Unit1TestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/Unit1TestCase.java?rev=430615&view=auto
==============================================================================
--- 
incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/Unit1TestCase.java
 (added)
+++ 
incubator/cayenne/main/trunk/integration-test/jpa-unit1/src/test/java/org/apache/cayenne/jpa/itest/entity/Unit1TestCase.java
 Thu Aug 10 18:43:50 2006
@@ -0,0 +1,40 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+package org.apache.cayenne.jpa.itest.entity;
+
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.cayenne.jpa.itest.ItestSetup;
+
+/**
+ * A common superclass of JpaUnit1 test cases that initializes static 
environment on load.
+ * 
+ * @author Andrus Adamchik
+ */
+public class Unit1TestCase extends TestCase {
+
+    static {
+        Properties properties = new Properties();
+        properties.setProperty(ItestSetup.JPA_UNIT_NAME, "ItestUnit1");
+        properties.setProperty(ItestSetup.SCHEMA_SCRIPT_URL, 
"unit1-schema-hsqldb.sql");
+        ItestSetup.initInstance(properties);
+    }
+}


Reply via email to