db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r395567 - in /db/jdo/trunk/tck20/src: java/org/apache/jdo/tck/mapping/ java/org/apache/jdo/tck/pc/company/ orm/applicationidentity/org/apache/jdo/tck/pc/company/ orm/datastoreidentity/org/apache/jdo/tck/pc/company/ sql/derby/applicationiden...
Date Thu, 20 Apr 2006 11:50:48 GMT
Author: mbo
Date: Thu Apr 20 04:50:43 2006
New Revision: 395567

URL: http://svn.apache.org/viewcvs?rev=395567&view=rev
Log:
JDO-369 Completeness test doesn't clean up instances of persistent interfaces

Modified:
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTest.java
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactory.java
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryConcreteClass.java
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMClass.java
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMInterface.java
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java
    db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm
    db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm
    db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
    db/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTest.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTest.java?rev=395567&r1=395566&r2=395567&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTest.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTest.java Thu Apr 20
04:50:43 2006
@@ -47,6 +47,9 @@
     
     /** */
     private final boolean isTestToBePerformed = isTestToBePerformed();
+
+    /** */
+    private CompanyModelReader reader;
     
     /** */
     protected List rootOids;
@@ -68,7 +71,11 @@
      */
     protected void localSetUp() {
         if (isTestToBePerformed) {
-            addTearDownClass(CompanyModelReader.getTearDownClasses());
+            // register the default factory
+            CompanyFactoryRegistry.registerFactory();
+            // get new obj graph to compare persistent graph with
+            reader = new CompanyModelReader(inputFilename);
+            addTearDownClass(reader.getTearDownClassesFromFactory());
             getPM();
             CompanyFactoryRegistry.registerFactory(pm);
             CompanyModelReader reader = new CompanyModelReader(inputFilename);
@@ -89,10 +96,6 @@
     /** */
     public void test() {
         if (isTestToBePerformed) {
-            // register the default factory
-            CompanyFactoryRegistry.registerFactory();
-            // get new obj graph to compare persistent graph with
-            CompanyModelReader reader = new CompanyModelReader(inputFilename);
             List rootList = reader.getRootList();
             
             getPM();

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactory.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactory.java?rev=395567&r1=395566&r2=395567&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactory.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactory.java Thu Apr
20 04:50:43 2006
@@ -63,4 +63,5 @@
             String first, String last, String middle,
             Date born, IAddress addr, Date hired, double wage); 
     IProject newProject(long projid, String name, BigDecimal budget);
+    Class[] getTearDownClasses();
 }

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryConcreteClass.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryConcreteClass.java?rev=395567&r1=395566&r2=395567&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryConcreteClass.java
(original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryConcreteClass.java
Thu Apr 20 04:50:43 2006
@@ -28,6 +28,14 @@
  */
 public  class CompanyFactoryConcreteClass implements CompanyFactory {
 
+    /** */
+    public static final Class[] tearDownClasses = new Class[] {
+        DentalInsurance.class, MedicalInsurance.class,
+        Person.class, Employee.class, 
+        PartTimeEmployee.class, FullTimeEmployee.class,  
+        Project.class, Department.class, Company.class
+    };
+
     public CompanyFactoryConcreteClass(PersistenceManager pm) {
     }
 
@@ -130,5 +138,9 @@
     public IProject newProject(long projid, String name, 
             BigDecimal budget) {
         return new Project(projid, name, budget);
+    }
+
+    public Class[] getTearDownClasses() {
+        return tearDownClasses;
     }
 }

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMClass.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMClass.java?rev=395567&r1=395566&r2=395567&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMClass.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMClass.java Thu
Apr 20 04:50:43 2006
@@ -27,6 +27,14 @@
 public class CompanyFactoryPMClass 
         extends CompanyFactoryAbstractImpl {
     
+    /** */
+    public static final Class[] tearDownClasses = new Class[] {
+        DentalInsurance.class, IMedicalInsurance.class,
+        Person.class, Employee.class, 
+        PartTimeEmployee.class, FullTimeEmployee.class,  
+        Project.class, Department.class, Company.class
+    };
+
     /**
      * Creates a new instance of CompanyFactoryPMInterface 
      */
@@ -66,4 +74,7 @@
         return (IProject)pm.newInstance(Project.class);
     }
 
+    public Class[] getTearDownClasses() {
+        return tearDownClasses;
+    }
 }

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMInterface.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMInterface.java?rev=395567&r1=395566&r2=395567&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMInterface.java
(original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMInterface.java
Thu Apr 20 04:50:43 2006
@@ -27,6 +27,14 @@
 public class CompanyFactoryPMInterface 
         extends CompanyFactoryAbstractImpl {
     
+    /** */
+    public static final Class[] tearDownClasses = new Class[] {
+        IDentalInsurance.class, IMedicalInsurance.class,
+        IPerson.class, IEmployee.class, 
+        IPartTimeEmployee.class, IFullTimeEmployee.class,  
+        IProject.class, IDepartment.class, ICompany.class
+    };
+
     /**
      * Creates a new instance of CompanyFactoryPMInterface 
      */
@@ -66,4 +74,7 @@
         return (IProject)pm.newInstance(IProject.class);
     }
 
+    public Class[] getTearDownClasses() {
+        return tearDownClasses;
+    }
 }

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java?rev=395567&r1=395566&r2=395567&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java Thu
Apr 20 04:50:43 2006
@@ -47,24 +47,9 @@
      */
     public static final String BEAN_FACTORY_NAME = "companyFactory";
 
-    /** All classes in the model 
-     */
-    private static final Class[] allClasses = new Class[] {
-        Address.class, Company.class, 
-        DentalInsurance.class, Department.class, Employee.class,
-        FullTimeEmployee.class, Insurance.class, 
-        MedicalInsurance.class, PartTimeEmployee.class, Person.class, 
-        Project.class
-    };
-    
-    /** All classes in the model 
-     */
-    private static final Class[] tearDownClasses = new Class[] {
-        DentalInsurance.class, MedicalInsurance.class,
-        Person.class, Employee.class, PartTimeEmployee.class, FullTimeEmployee.class,  
-        Project.class, Department.class, Company.class
-    };
-    
+    /** The company factory instance. */
+    private CompanyFactory companyFactory;
+
     /** 
      * Create a CompanyModelReader for the specified resourceName. 
      * @param resourceName the name of the resource
@@ -112,7 +97,8 @@
         CustomDateEditor dateEditor = 
             new CustomDateEditor(formatter, true);
         registerCustomEditor(Date.class, dateEditor);
-        addSingleton(BEAN_FACTORY_NAME, CompanyFactoryRegistry.getInstance());
+        companyFactory = CompanyFactoryRegistry.getInstance();
+        addSingleton(BEAN_FACTORY_NAME, companyFactory);
     }
     
     // Convenience methods
@@ -249,17 +235,20 @@
         return (Project)getBean(name, Project.class);
     }
     
-    public static Class[] getAllClasses() {
-        return allClasses;
+    /**
+     * @return Returns the tearDownClasses.
+     */
+    public Class[] getTearDownClassesFromFactory() {
+        return companyFactory.getTearDownClasses();
     }
     
     /**
      * @return Returns the tearDownClasses.
      */
     public static Class[] getTearDownClasses() {
-        return tearDownClasses;
+        return CompanyFactoryConcreteClass.tearDownClasses;
     }
-    
+
     public static Date stringToUtilDate(String value) {
         return ConversionHelper.toUtilDate(DATE_PATTERN, "America/New_York", Locale.US, value);
     }

Modified: db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm?rev=395567&r1=395566&r2=395567&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm
(original)
+++ db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-standard.orm
Thu Apr 20 04:50:43 2006
@@ -10,6 +10,9 @@
     <package name="org.apache.jdo.tck.pc.company">
 
         <class name="Company" table="companies">
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"/>
+            </inheritance>
             <field name="companyid" column="ID"/>
             <field name="name" column="NAME">
               <column name="NAME" sql-type="VARCHAR"/>
@@ -29,6 +32,9 @@
         </class>
 
         <class name="Department" table="departments">
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"/>
+            </inheritance>
             <field name="deptid" column="ID"/>
             <field name="name" column="NAME"/>
             <field name="company" column="COMPANYID"/>
@@ -144,6 +150,9 @@
         </class>
 
         <class name="Project" table="projects">
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"/>
+            </inheritance>
             <field name="projid" column="PROJID"/>
             <field name="name" column="NAME"/>
             <field name="budget">
@@ -164,6 +173,9 @@
         </class>
 
         <interface name="ICompany" table="companies">
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"/>
+            </inheritance>
             <property name="companyid" column="ID"/>
             <property name="name" column="NAME">
               <column name="NAME" sql-type="VARCHAR"/>
@@ -183,6 +195,9 @@
         </interface>
 
         <interface name="IDepartment" table="departments">
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"/>
+            </inheritance>
             <property name="deptid" column="ID"/>
             <property name="name" column="NAME"/>
             <property name="company" column="COMPANYID"/>
@@ -298,6 +313,9 @@
         </interface>
 
         <interface name="IProject" table="projects">
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"/>
+            </inheritance>
             <property name="projid" column="PROJID"/>
             <property name="name" column="NAME"/>
             <property name="budget">

Modified: db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm?rev=395567&r1=395566&r2=395567&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm
(original)
+++ db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-standard.orm
Thu Apr 20 04:50:43 2006
@@ -11,6 +11,9 @@
 
         <class name="Company" table="companies">
             <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"/>
+            </inheritance>
             <field name="companyid" column="ID"/>
             <field name="name" column="NAME">
               <column name="NAME" sql-type="VARCHAR"/>
@@ -43,6 +46,9 @@
 
         <class name="Department" table="departments">
             <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"/>
+            </inheritance>
             <field name="deptid" column="ID"/>
             <field name="name" column="NAME"/>
             <field name="company" column="COMPANYID"/>
@@ -149,6 +155,9 @@
 
         <class name="Project" table="projects">
             <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"/>
+            </inheritance>
             <field name="projid" column="PROJID"/>
             <field name="name" column="NAME"/>
             <field name="budget">
@@ -168,6 +177,9 @@
 
         <interface name="ICompany" table="companies">
             <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"/>
+            </inheritance>
             <property name="companyid" column="ID"/>
             <property name="name" column="NAME">
               <column name="NAME" sql-type="VARCHAR"/>
@@ -188,6 +200,9 @@
 
         <interface name="IDepartment" table="departments">
             <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"/>
+            </inheritance>
             <property name="deptid" column="ID"/>
             <property name="name" column="NAME"/>
             <property name="company" column="COMPANYID"/>
@@ -306,6 +321,9 @@
 
         <interface name="IProject" table="projects">
             <datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
+            <inheritance strategy="new-table">
+                <discriminator strategy="class-name" column="DISCRIMINATOR"/>
+            </inheritance>
             <property name="projid" column="PROJID"/>
             <property name="name" column="NAME"/>
             <property name="budget">

Modified: db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql?rev=395567&r1=395566&r2=395567&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql (original)
+++ db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql Thu Apr 20 04:50:43 2006
@@ -182,6 +182,7 @@
     STATE CHAR(2),
     ZIPCODE CHAR(5),
     COUNTRY VARCHAR(64),
+    DISCRIMINATOR VARCHAR(255),
     CONSTRAINT COMPS_PK PRIMARY KEY (ID)
 );
 
@@ -190,6 +191,7 @@
     NAME VARCHAR(32) NOT NULL,
     EMP_OF_THE_MONTH INTEGER,
     COMPANYID INTEGER REFERENCES companies,
+    DISCRIMINATOR VARCHAR(255),
     CONSTRAINT DEPTS_PK PRIMARY KEY (ID)
 );
 
@@ -232,6 +234,7 @@
     PROJID INTEGER NOT NULL,
     NAME VARCHAR(32) NOT NULL,
     BUDGET DECIMAL(11,2) NOT NULL,
+    DISCRIMINATOR VARCHAR(255),
     CONSTRAINT PROJS_PK PRIMARY KEY (PROJID)
 );
 

Modified: db/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql?rev=395567&r1=395566&r2=395567&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql (original)
+++ db/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql Thu Apr 20 04:50:43 2006
@@ -130,6 +130,7 @@
     STATE CHAR(2),
     ZIPCODE CHAR(5),
     COUNTRY VARCHAR(64),
+    DISCRIMINATOR VARCHAR(255),
     CONSTRAINT COMPS_PK PRIMARY KEY (DATASTORE_IDENTITY)
 );
 
@@ -139,6 +140,7 @@
     NAME VARCHAR(32) NOT NULL,
     EMP_OF_THE_MONTH INTEGER,
     COMPANYID INTEGER REFERENCES companies,
+    DISCRIMINATOR VARCHAR(255),
     CONSTRAINT DEPTS_PK PRIMARY KEY (DATASTORE_IDENTITY)
 );
 
@@ -185,6 +187,7 @@
     PROJID INTEGER NOT NULL,
     NAME VARCHAR(32) NOT NULL,
     BUDGET DECIMAL(11,2) NOT NULL,
+    DISCRIMINATOR VARCHAR(255),
     CONSTRAINT PROJS_UK UNIQUE (PROJID),
     CONSTRAINT PROJS_PK PRIMARY KEY (DATASTORE_IDENTITY)
 );



Mime
View raw message