You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Michael Bouschen <mb...@spree.de> on 2006/03/11 21:16:20 UTC

Fix for completeness test failures (was: Minutes: JDO TCK Conference Call Friday, Mar 10, 9 am PST)

Hi,

> Michael noticed a number of configurations have failed. AI Craig: see  
> if changes to PMInterface have affected this problem.
>
Some test configurations using the completeness test result in a 
ClassNotFoundException when trying to resolve the company factory class 
and others result show an exception thrown from the 
CompanyFactoryPMInterface where a different factory should have been used.

I found two issues:
(1) Only a few configurations explicitly set the property 
jdo.tck.mapping.companyfactory, because all the other configurations use 
the default factory. All .conf files are read by the same JVM, so once 
the property is set is remains the same until a configuration explicitly 
defines it. This means all configuration need to defines the property 
jdo.tck.mapping.companyfactory.
(2) maven.xml passes the property jdo.tck.mapping.companyfactory as 
system property to the test run:
    <sysproperty key="jdo.tck.mapping.companyfactory"
                         value="${jdo.tck.mapping.companyfactory}"/>
This means the system property is defined in any case, but often the 
value is the empty string. This means the default handling as used in 
class CompanyFactoryRegistry does not work:
  System.getProperty(FACTORY_PROPERTY_NAME, DEFAULT_FACTORY_CLASS_NAME);
I changed the code in CompanyFactoryRegistry to explicitly check for the 
empty string when resolving the company factory.

Attached you find a patch for review fixing both issues.

Regards Michael

-- 
Michael Bouschen		Tech@Spree Engineering GmbH
mailto:mbo.tech@spree.de	http://www.tech.spree.de/
Tel.:++49/30/235 520-33		Buelowstr. 66			
Fax.:++49/30/2175 2012		D-10783 Berlin			


Re: Fix for completeness test failures (was: Minutes: JDO TCK Conference Call Friday, Mar 10, 9 am PST)

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi,

Thanks for volunteering to take this AI for me.

Your patch looks good.

Craig

On Mar 11, 2006, at 12:16 PM, Michael Bouschen wrote:

> Hi,
>
>> Michael noticed a number of configurations have failed. AI Craig:  
>> see  if changes to PMInterface have affected this problem.
>>
> Some test configurations using the completeness test result in a  
> ClassNotFoundException when trying to resolve the company factory  
> class and others result show an exception thrown from the  
> CompanyFactoryPMInterface where a different factory should have  
> been used.
>
> I found two issues:
> (1) Only a few configurations explicitly set the property  
> jdo.tck.mapping.companyfactory, because all the other  
> configurations use the default factory. All .conf files are read by  
> the same JVM, so once the property is set is remains the same until  
> a configuration explicitly defines it. This means all configuration  
> need to defines the property jdo.tck.mapping.companyfactory.
> (2) maven.xml passes the property jdo.tck.mapping.companyfactory as  
> system property to the test run:
>    <sysproperty key="jdo.tck.mapping.companyfactory"
>                         value="${jdo.tck.mapping.companyfactory}"/>
> This means the system property is defined in any case, but often  
> the value is the empty string. This means the default handling as  
> used in class CompanyFactoryRegistry does not work:
>  System.getProperty(FACTORY_PROPERTY_NAME,  
> DEFAULT_FACTORY_CLASS_NAME);
> I changed the code in CompanyFactoryRegistry to explicitly check  
> for the empty string when resolving the company factory.
>
> Attached you find a patch for review fixing both issues.
>
> Regards Michael
>
> -- 
> Michael Bouschen		Tech@Spree Engineering GmbH
> mailto:mbo.tech@spree.de	http://www.tech.spree.de/
> Tel.:++49/30/235 520-33		Buelowstr. 66			
> Fax.:++49/30/2175 2012		D-10783 Berlin			
>
> Index: src/java/org/apache/jdo/tck/pc/company/ 
> CompanyFactoryRegistry.java
> ===================================================================
> --- src/java/org/apache/jdo/tck/pc/company/ 
> CompanyFactoryRegistry.java	(Revision 385042)
> +++ src/java/org/apache/jdo/tck/pc/company/ 
> CompanyFactoryRegistry.java	(Arbeitskopie)
> @@ -54,9 +54,15 @@
>      /**
>       * The default factory class name
>       */
> -    final static String FACTORY_CLASS_NAME =
> -        System.getProperty(FACTORY_PROPERTY_NAME,  
> DEFAULT_FACTORY_CLASS_NAME);
> +    final static String FACTORY_CLASS_NAME;
>
> +    static {
> +        String prop = System.getProperty(FACTORY_PROPERTY_NAME);
> +        if ((prop == null) || (prop.length() == 0))
> +            prop = DEFAULT_FACTORY_CLASS_NAME;
> +        FACTORY_CLASS_NAME = prop;
> +    }
> +
>      /**
>       * This is the default company factory singleton. This is  
> statically
>       * loaded regardless of the setting of the system property.
> Index: src/conf/lifecycle.conf
> ===================================================================
> --- src/conf/lifecycle.conf	(Revision 385042)
> +++ src/conf/lifecycle.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = All lifecycle tests with standard mapping,  
> no testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 0
> Index: src/conf/schemaAttributePackage.conf
> ===================================================================
> --- src/conf/schemaAttributePackage.conf	(Revision 385042)
> +++ src/conf/schemaAttributePackage.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = MakePersistent test with schema name  
> specified as package attribute in orm for PCPoint. Schema name  
> derived from jdo.tck.mapping 1 is overriden in orm
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes =  
> org.apache.jdo.tck.api.persistencemanager.lifecycle.MakePersistent
>  jdo.tck.testdata =
>  jdo.tck.mapping = 6
> Index: src/conf/instancecallbacks.conf
> ===================================================================
> --- src/conf/instancecallbacks.conf	(Revision 385042)
> +++ src/conf/instancecallbacks.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = All instancecallback tests with standard  
> mapping, no testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 0
> Index: src/conf/query.conf
> ===================================================================
> --- src/conf/query.conf	(Revision 385042)
> +++ src/conf/query.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = All query tests with standard mapping, no  
> testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 0
> Index: src/conf/inheritance1.conf
> ===================================================================
> --- src/conf/inheritance1.conf	(Revision 385042)
> +++ src/conf/inheritance1.conf	(Arbeitskopie)
> @@ -2,6 +2,7 @@
>  Separate table for each class in the inheritance hierarchy. \
>  Each table contains columns for the declared fields. \
>  Inheritance strategy: new-table for all classes.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest
>  jdo.tck.testdata = org/apache/jdo/tck/pc/company/ 
> companyAllRelationships.xml
>  jdo.tck.mapping = 1
> Index: src/conf/schemaAttributeClass.conf
> ===================================================================
> --- src/conf/schemaAttributeClass.conf	(Revision 385042)
> +++ src/conf/schemaAttributeClass.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = MakePersistent test with schema name  
> specified as class attribute in orm for PCPoint. Schema name  
> derived from jdo.tck.mapping 1 is overriden in orm
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes =  
> org.apache.jdo.tck.api.persistencemanager.lifecycle.MakePersistent
>  jdo.tck.testdata =
>  jdo.tck.mapping = 7
> Index: src/conf/inheritance3.conf
> ===================================================================
> --- src/conf/inheritance3.conf	(Revision 385042)
> +++ src/conf/inheritance3.conf	(Arbeitskopie)
> @@ -4,6 +4,7 @@
>  PartTimeEmployee and FullTimeEmployee has inheritance strategy  
> "new-table". \
>  Insurance has inheritance strategy "subclass-table". \
>  MedicalInsurance and DentalInsurance have inheritance strategy  
> "new-table".
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest
>  jdo.tck.testdata = org/apache/jdo/tck/pc/company/ 
> companyAllRelationships.xml
>  jdo.tck.mapping = 3
> Index: src/conf/models.conf
> ===================================================================
> --- src/conf/models.conf	(Revision 385042)
> +++ src/conf/models.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = All model tests with standard mapping, no  
> testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 0
> Index: src/conf/enhancement.conf
> ===================================================================
> --- src/conf/enhancement.conf	(Revision 385042)
> +++ src/conf/enhancement.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = All enhancement, persistencecapable tests  
> with standard mapping, no testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 0
> Index: src/conf/company1-MRelationships.conf
> ===================================================================
> --- src/conf/company1-MRelationships.conf	(Revision 385042)
> +++ src/conf/company1-MRelationships.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = Completeness test with standard mapping,  
> basic testdata with 1-M relationships.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest
>  jdo.tck.testdata = org/apache/jdo/tck/pc/company/company1- 
> MRelationships.xml
>  jdo.tck.mapping = 0
> Index: src/conf/detach.conf
> ===================================================================
> --- src/conf/detach.conf	(Revision 385042)
> +++ src/conf/detach.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = Detachment tests with standard mapping, no  
> testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 8
> Index: src/conf/schemaAttributeOrm.conf
> ===================================================================
> --- src/conf/schemaAttributeOrm.conf	(Revision 385042)
> +++ src/conf/schemaAttributeOrm.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = MakePersistent test with schema name  
> specified as orm attribute in orm for PCPoint. Schema name derived  
> from jdo.tck.mapping 1 is overriden in orm
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes =  
> org.apache.jdo.tck.api.persistencemanager.lifecycle.MakePersistent
>  jdo.tck.testdata =
>  jdo.tck.mapping = 5
> Index: src/conf/fetchplan.conf
> ===================================================================
> --- src/conf/fetchplan.conf	(Revision 385042)
> +++ src/conf/fetchplan.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = All pm tests with standard mapping, no  
> testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 0
> Index: src/conf/companyAllRelationships.conf
> ===================================================================
> --- src/conf/companyAllRelationships.conf	(Revision 385042)
> +++ src/conf/companyAllRelationships.conf	(Arbeitskopie)
> @@ -1,5 +1,6 @@
>  jdo.tck.description = Completeness test with standard mapping,  
> basic testdata with all relationships \
>  and embedded objects.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest
>  jdo.tck.testdata = org/apache/jdo/tck/pc/company/ 
> companyAllRelationships.xml
>  jdo.tck.mapping = 0
> Index: src/conf/companyNoRelationships.conf
> ===================================================================
> --- src/conf/companyNoRelationships.conf	(Revision 385042)
> +++ src/conf/companyNoRelationships.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = Completeness test with standard mapping,  
> basic testdata with no relationships.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest
>  jdo.tck.testdata = org/apache/jdo/tck/pc/company/ 
> companyNoRelationships.xml
>  jdo.tck.mapping = 0
> Index: src/conf/transactions.conf
> ===================================================================
> --- src/conf/transactions.conf	(Revision 385042)
> +++ src/conf/transactions.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = All transaction tests with standard mapping,  
> no testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 0
> Index: src/conf/jdoql.conf
> ===================================================================
> --- src/conf/jdoql.conf	(Revision 385042)
> +++ src/conf/jdoql.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = All jdoql tests with standard mapping, no  
> testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 0
> Index: src/conf/inheritance2.conf
> ===================================================================
> --- src/conf/inheritance2.conf	(Revision 385042)
> +++ src/conf/inheritance2.conf	(Arbeitskopie)
> @@ -9,6 +9,7 @@
>  Separate phone number type tables for persons, fulltime employees, \
>  and parttime employees. \
>  Inheritance strategy: new-table for all classes.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest
>  jdo.tck.testdata = org/apache/jdo/tck/pc/company/ 
> companyAllRelationships.xml
>  jdo.tck.mapping = 2
> Index: src/conf/pm.conf
> ===================================================================
> --- src/conf/pm.conf	(Revision 385042)
> +++ src/conf/pm.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = All pm tests with standard mapping, no  
> testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 0
> Index: src/conf/jdohelper.conf
> ===================================================================
> --- src/conf/jdohelper.conf	(Revision 385042)
> +++ src/conf/jdohelper.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = All jdohelper tests with standard mapping,  
> no testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 0
> Index: src/conf/inheritance4.conf
> ===================================================================
> --- src/conf/inheritance4.conf	(Revision 385042)
> +++ src/conf/inheritance4.conf	(Arbeitskopie)
> @@ -2,6 +2,7 @@
>  Person, Employee, and Insurance have inheritance strategy "new- 
> table". \
>  PartTimeEmployee, FullTimeEmployee, MedicalInsurance, and  
> DentalInsurance \
>  have inheritance strategy "superclass-table".
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest
>  jdo.tck.testdata = org/apache/jdo/tck/pc/company/ 
> companyAllRelationships.xml
>  jdo.tck.mapping = 4
> Index: src/conf/companyEmbedded.conf
> ===================================================================
> --- src/conf/companyEmbedded.conf	(Revision 385042)
> +++ src/conf/companyEmbedded.conf	(Arbeitskopie)
> @@ -1,5 +1,6 @@
>  jdo.tck.description = Completeness test with standard mapping,  
> basic testdata with no relationships \
>  and embedded objects.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest
>  jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyEmbedded.xml
>  jdo.tck.mapping = 0
> Index: src/conf/companyM-MRelationships.conf
> ===================================================================
> --- src/conf/companyM-MRelationships.conf	(Revision 385042)
> +++ src/conf/companyM-MRelationships.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = Completeness test with standard mapping,  
> basic testdata with M-M relationships.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest
>  jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyM- 
> MRelationships.xml
>  jdo.tck.mapping = 0
> Index: src/conf/pmf.conf
> ===================================================================
> --- src/conf/pmf.conf	(Revision 385042)
> +++ src/conf/pmf.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = All pmf tests with standard mapping, no  
> testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 0
> Index: src/conf/extents.conf
> ===================================================================
> --- src/conf/extents.conf	(Revision 385042)
> +++ src/conf/extents.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = All extent tests with standard mapping, no  
> testdata.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.testdata =
>  jdo.tck.standarddata =
>  jdo.tck.mapping = 0
> Index: src/conf/company1-1Relationships.conf
> ===================================================================
> --- src/conf/company1-1Relationships.conf	(Revision 385042)
> +++ src/conf/company1-1Relationships.conf	(Arbeitskopie)
> @@ -1,4 +1,5 @@
>  jdo.tck.description = Completeness test with standard mapping,  
> basic testdata with 1-1 relationships.
> +jdo.tck.mapping.companyfactory =
>  jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest
>  jdo.tck.testdata = org/apache/jdo/tck/pc/company/ 
> company1-1Relationships.xml
>  jdo.tck.mapping = 0

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!