db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcai...@apache.org
Subject svn commit: r160090 [15/63] - in incubator/jdo/trunk: ./ tck20/ tck20/assertions/ tck20/iut_jars/ tck20/test/ tck20/test/conf/ tck20/test/java/ tck20/test/java/org/ tck20/test/java/org/apache/ tck20/test/java/org/apache/jdo/ tck20/test/java/org/apache/jdo/tck/ tck20/test/java/org/apache/jdo/tck/api/ tck20/test/java/org/apache/jdo/tck/api/instancecallbacks/ tck20/test/java/org/apache/jdo/tck/api/jdohelper/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/extent/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/ tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/ tck20/test/java/org/apache/jdo/tck/enhancement/ tck20/test/java/org/apache/jdo/tck/extents/ tck20/test/java/org/apache/jdo/tck/lifecycle/ tck20/test/java/org/apache/jdo/tck/lifecycle/nontransactional/ tck20/test/java/org/apache/jdo/tck/models/ tck20/test/java/org/apache/jdo/tck/models/embedded/ tck20/test/java/org/apache/jdo/tck/models/fieldtypes/ tck20/test/java/org/apache/jdo/tck/models/inheritance/ tck20/test/java/org/apache/jdo/tck/pc/ tck20/test/java/org/apache/jdo/tck/pc/company/ tck20/test/java/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/java/org/apache/jdo/tck/pc/inheritance/ tck20/test/java/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/java/org/apache/jdo/tck/pc/lifecycle/ tck20/test/java/org/apache/jdo/tck/pc/mylib/ tck20/test/java/org/apache/jdo/tck/query/ tck20/test/java/org/apache/jdo/tck/query/operators/ tck20/test/java/org/apache/jdo/tck/transactions/ tck20/test/java/org/apache/jdo/tck/util/ tck20/test/jdo/ tck20/test/jdo/applicationidentity/ tck20/test/jdo/applicationidentity/org/ tck20/test/jdo/applicationidentity/org/apache/ tck20/test/jdo/applicationidentity/org/apache/jdo/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/company/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/jdo/datastoreidentity/ tck20/test/jdo/datastoreidentity/org/ tck20/test/jdo/datastoreidentity/org/apache/ tck20/test/jdo/datastoreidentity/org/apache/jdo/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/company/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/orm/ tck20/test/orm/applicationidentity/ tck20/test/orm/applicationidentity/org/ tck20/test/orm/applicationidentity/org/apache/ tck20/test/orm/applicationidentity/org/apache/jdo/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/company/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/orm/datastoreidentity/ tck20/test/orm/datastoreidentity/org/ tck20/test/orm/datastoreidentity/org/apache/ tck20/test/orm/datastoreidentity/org/apache/jdo/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/company/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/sql/ tck20/test/sql/derby/
Date Mon, 04 Apr 2005 19:43:47 GMT
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLong.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLong.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLong.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLong.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfLong;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type Long.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-14.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of the immutable object class
+<code>java.lang.Long</code>, and may choose to support them as
+Second Class Objects or First Class Objects.
+ */
+
+
+public class TestFieldsOfLong extends JDO_Test {
+    
+   /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-14 (TestFieldsOfLong) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfLong.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            Long firstValue = new Long(Long.MIN_VALUE);
+            Long secondValue = new Long(Long.MAX_VALUE);
+            tx.begin();
+            FieldsOfLong pi = new FieldsOfLong();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0; i < n; ++i){
+                pi.set( i, firstValue);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            pi = (FieldsOfLong) pm.getObjectById(oid, true);
+            checkValues(oid, firstValue); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0; i < n; ++i){
+                pi.set(i, secondValue);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, secondValue);
+            pi = (FieldsOfLong) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, Long startValue){
+        int i;
+        FieldsOfLong pi = (FieldsOfLong) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0; i < n; ++i){
+            if( !FieldsOfLong.isPersistent[i] ) continue;
+            Long val = pi.get(i);
+            if(!val.equals(startValue) ){
+                fail(ASSERTION_FAILED,
+                     "Incorrect value for " + FieldsOfLong.fieldSpecs[i] +
+                     ", expected value " + startValue.toString() +
+                     ", value is " + val.toString());
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLong.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfObject.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfObject.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfObject.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfObject.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfObject;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type Object.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-31.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of <code>Object</code> class type
+as First Class Objects. The implementation is permitted, but is not required,
+to allow any class to be assigned to the field. If an implementation restricts
+instances to be assigned to the field, a <code>ClassCastException</code>
+must be thrown at the time of any incorrect assignment.
+ */
+
+
+public class TestFieldsOfObject extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-31 (TestFieldsOfObject) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfObject.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            Object firstValue = new String("Hello");
+            Object secondValue = new Integer("420");
+            tx.begin();
+            FieldsOfObject pi = new FieldsOfObject();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0; i < n; ++i){
+                pi.set( i, firstValue);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            pi = (FieldsOfObject) pm.getObjectById(oid, true);
+            checkValues(oid, firstValue); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0; i < n; ++i){
+                pi.set(i, secondValue);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, secondValue);
+            pi = (FieldsOfObject) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, Object startValue){
+        int i;
+        FieldsOfObject pi = (FieldsOfObject) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0; i < n; ++i){
+            if( !FieldsOfObject.isPersistent[i] ) continue;
+            Object val = pi.get(i);
+            if(!val.equals(startValue) ){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfObject.fieldSpecs[i] +
+                        ", expected value " + startValue.toString() +
+                        ", value is " + val.toString());
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfObject.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveboolean.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveboolean.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveboolean.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveboolean.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfPrimitiveboolean;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type boolean.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of the primitive type <code>boolean</code>.
+ */
+
+public class TestFieldsOfPrimitiveboolean extends JDO_Test {
+    
+     /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-1 (TestFieldsOfPrimitiveboolean) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfPrimitiveboolean.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            boolean value;
+            tx.begin();
+            FieldsOfPrimitiveboolean pi = new FieldsOfPrimitiveboolean();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0, value = true; i < n; ++i){
+                pi.set( i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            pi = (FieldsOfPrimitiveboolean) pm.getObjectById(oid, true);
+            checkValues(oid, true); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0, value = false; i < n; ++i){
+                pi.set(i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, false);
+            pi = (FieldsOfPrimitiveboolean) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, boolean startValue){
+        int i;
+        FieldsOfPrimitiveboolean pi = (FieldsOfPrimitiveboolean) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0; i < n; ++i){
+            if( !FieldsOfPrimitiveboolean.isPersistent[i] ) continue;
+            boolean val = pi.get(i);
+            if( val != startValue ){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfPrimitiveboolean.fieldSpecs[i] +
+                        ", expected value " + startValue +
+                        ", value is " + val);
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveboolean.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivebyte.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivebyte.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivebyte.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivebyte.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfPrimitivebyte;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type byte.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of the primitive type <code>int</code>.
+ */
+
+
+public class TestFieldsOfPrimitivebyte extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-2 (TestFieldsOfPrimitivebyte) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfPrimitivebyte.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            byte value;
+            tx.begin();
+            FieldsOfPrimitivebyte pi = new FieldsOfPrimitivebyte();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0, value = 10; i < n; ++i){
+                pi.set( i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            pi = (FieldsOfPrimitivebyte) pm.getObjectById(oid, true);
+            checkValues(oid, (byte)10); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0, value = 127; i < n; ++i){
+                pi.set(i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, (byte)127);
+            pi = (FieldsOfPrimitivebyte) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, byte startValue){
+        int i;
+        FieldsOfPrimitivebyte pi = (FieldsOfPrimitivebyte) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0; i < n; ++i){
+            if( !FieldsOfPrimitivebyte.isPersistent[i] ) continue;
+            byte val = pi.get(i);
+            if( val != startValue ){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfPrimitivebyte.fieldSpecs[i] +
+                        ", expected value " + startValue +
+                        ", value is " + val);
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivebyte.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivechar.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivechar.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivechar.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivechar.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfPrimitivechar;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type char.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-6.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of the primitive type <code>char</code>.
+ */
+
+
+public class TestFieldsOfPrimitivechar extends JDO_Test {
+    
+  /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-6 (TestFieldsOfPrimitivechar) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfPrimitivechar.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            char value;
+            tx.begin();
+            FieldsOfPrimitivechar pi = new FieldsOfPrimitivechar();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0, value = 'a'; i < n; ++i){
+                pi.set( i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            pi = (FieldsOfPrimitivechar) pm.getObjectById(oid, true);
+            checkValues(oid, 'a'); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0, value = 'Z'; i < n; ++i){
+                pi.set(i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, 'Z');
+            pi = (FieldsOfPrimitivechar) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, char startValue){
+        int i;
+        FieldsOfPrimitivechar pi = (FieldsOfPrimitivechar) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0; i < n; ++i){
+            if( !FieldsOfPrimitivechar.isPersistent[i] ) continue;
+            char val = pi.get(i);
+            if( val != startValue ){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfPrimitivechar.fieldSpecs[i] +
+                        ", expected value " + startValue +
+                        ", value is " + val);
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivechar.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivedouble.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivedouble.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivedouble.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivedouble.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfPrimitivedouble;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type double.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-8.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of the primitive type <code>double</code>.
+ */
+
+
+public class TestFieldsOfPrimitivedouble extends JDO_Test {
+    
+   /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-8 (TestFieldsOfPrimitivedouble) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfPrimitivedouble.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            double value;
+            tx.begin();
+            FieldsOfPrimitivedouble pi = new FieldsOfPrimitivedouble();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0, value = (double)10.15; i < n; ++i){
+                pi.set( i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            pi = (FieldsOfPrimitivedouble) pm.getObjectById(oid, true);
+            checkValues(oid, (double)10.15); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0, value = (double)68000.15; i < n; ++i){
+                pi.set(i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, (double)68000.15);
+            pi = (FieldsOfPrimitivedouble) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, double startValue){
+        int i;
+        FieldsOfPrimitivedouble pi = (FieldsOfPrimitivedouble) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0; i < n; ++i){
+            if( !FieldsOfPrimitivedouble.isPersistent[i] ) continue;
+            double val = pi.get(i);
+            if( val != startValue ){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfPrimitivedouble.fieldSpecs[i] +
+                        ", expected value " + startValue +
+                        ", value is " + val);
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivedouble.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivefloat.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivefloat.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivefloat.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivefloat.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfPrimitivefloat;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type float.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-7.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of the primitive type <code>float</code>.
+ */
+
+
+public class TestFieldsOfPrimitivefloat extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-7 (TestFieldsOfPrimitivefloat) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfPrimitivefloat.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            float value;
+            tx.begin();
+            FieldsOfPrimitivefloat pi = new FieldsOfPrimitivefloat();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0, value = (float)10.15; i < n; ++i){
+                pi.set( i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            pi = (FieldsOfPrimitivefloat) pm.getObjectById(oid, true);
+            checkValues(oid, (float)10.15); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0, value = (float)33000.15; i < n; ++i){
+                pi.set(i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, (float)33000.15);
+            pi = (FieldsOfPrimitivefloat) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, float startValue){
+        int i;
+        FieldsOfPrimitivefloat pi = (FieldsOfPrimitivefloat) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0; i < n; ++i){
+            if( !FieldsOfPrimitivefloat.isPersistent[i] ) continue;
+            float val = pi.get(i);
+            if( val != startValue ){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfPrimitivefloat.fieldSpecs[i] +
+                        ", expected value " + startValue +
+                        ", value is " + val);
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivefloat.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveint.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveint.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveint.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveint.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfPrimitiveint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type int.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-4.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of the primitive type <code>int</code>.
+ */
+
+
+public class TestFieldsOfPrimitiveint extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-4 (TestFieldsOfPrimitiveint) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfPrimitiveint.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n, value;
+            tx.begin();
+            FieldsOfPrimitiveint pi = new FieldsOfPrimitiveint();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0, value = 0; i < n; ++i, ++value ){
+                pi.set( i, value);            
+            }
+            tx.commit();
+            // cache will be flushed        
+            pi = null;
+            System.gc();
+        
+            tx.begin();
+            pi = (FieldsOfPrimitiveint) pm.getObjectById(oid, true);
+            checkValues(oid, 0); // check if persistent fields have values set
+    
+            // Provide new set of values 
+            for( i = 0, value = 1000; i < n; ++i, ++value ){
+                pi.set(i, value);
+            }
+            tx.commit();
+            // cache will be flushed        
+            pi = null;
+            System.gc();
+        
+            tx.begin();
+            // check new values
+            checkValues(oid, 1000);
+            pi = (FieldsOfPrimitiveint) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /** */
+    private void checkValues(Object oid, int startValue){
+        int i, value;
+        FieldsOfPrimitiveint pi = (FieldsOfPrimitiveint) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0, value = startValue; i < n; ++i, ++value){
+            if( !FieldsOfPrimitiveint.isPersistent[i] ) continue;
+            int val = pi.get(i);
+            if( val != value ){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfPrimitiveint.fieldSpecs[i] +
+                        ", expected value " + startValue +
+                        ", value is " + val);
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveint.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivelong.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivelong.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivelong.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivelong.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfPrimitivelong;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type long.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-5.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of the primitive type <code>long</code>.
+ */
+
+
+public class TestFieldsOfPrimitivelong extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-5 (TestFieldsOfPrimitivelong) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfPrimitivelong.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            long value;
+            tx.begin();
+            FieldsOfPrimitivelong pi = new FieldsOfPrimitivelong();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0, value = 10; i < n; ++i){
+                pi.set( i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            pi = (FieldsOfPrimitivelong) pm.getObjectById(oid, true);
+            checkValues(oid, 10); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0, value = 67000; i < n; ++i){
+                pi.set(i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, 67000);
+            pi = (FieldsOfPrimitivelong) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, long startValue){
+        int i;
+        long value;
+        FieldsOfPrimitivelong pi = (FieldsOfPrimitivelong) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0; i < n; ++i){
+            if( !FieldsOfPrimitivelong.isPersistent[i] ) continue;
+            long val = pi.get(i);
+            if( val != startValue ){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfPrimitivelong.fieldSpecs[i] +
+                        ", expected value " + startValue +
+                        ", value is " + val);
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivelong.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveshort.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveshort.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveshort.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveshort.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfPrimitiveshort;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type short.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-3.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of the primitive type <code>short</code>.
+ */
+
+public class TestFieldsOfPrimitiveshort extends JDO_Test {
+    
+   /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-3 (TestFieldsOfPrimitiveshort) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfPrimitiveshort.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            short value;
+            tx.begin();
+            FieldsOfPrimitiveshort pi = new FieldsOfPrimitiveshort();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0, value = 10; i < n; ++i){
+                pi.set( i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            pi = (FieldsOfPrimitiveshort) pm.getObjectById(oid, true);
+            checkValues(oid, (short)10); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0, value = 32000; i < n; ++i){
+                pi.set(i, value);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, (short)32000);
+            pi = (FieldsOfPrimitiveshort) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, short startValue){
+        int i;
+        FieldsOfPrimitiveshort pi = (FieldsOfPrimitiveshort) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0; i < n; ++i){
+            if( !FieldsOfPrimitiveshort.isPersistent[i] ) continue;
+            short val = pi.get(i);
+            if( val != startValue ){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfPrimitiveshort.fieldSpecs[i] +
+                        ", expected value " + startValue +
+                        ", value is " + val);
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveshort.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfShort.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfShort.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfShort.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfShort.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfShort;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type Short.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-12.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of the immutable object class
+<code>java.lang.Short</code>, and may choose to support them as
+Second Class Objects or First Class Objects.
+ */
+
+
+public class TestFieldsOfShort extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-12 (TestFieldsOfShort) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfShort.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            Short firstValue = new Short(Short.MIN_VALUE);
+            Short secondValue = new Short(Short.MAX_VALUE);
+            tx.begin();
+            FieldsOfShort pi = new FieldsOfShort();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0; i < n; ++i){
+                pi.set( i, firstValue);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            pi = (FieldsOfShort) pm.getObjectById(oid, true);
+            checkValues(oid, firstValue); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0; i < n; ++i){
+                pi.set(i, secondValue);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, secondValue);
+            pi = (FieldsOfShort) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, Short startValue){
+        int i;
+        Short value;
+        FieldsOfShort pi = (FieldsOfShort) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0, value = startValue; i < n; ++i){
+            if( !FieldsOfShort.isPersistent[i] ) continue;
+            Short val = pi.get(i);
+            if(!val.equals(startValue) ){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfShort.fieldSpecs[i] +
+                        ", expected value " + startValue.toString() +
+                        ", value is " + val.toString());
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfShort.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfSimpleClass.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfSimpleClass.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfSimpleClass.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfSimpleClass.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfSimpleClass;
+import org.apache.jdo.tck.pc.fieldtypes.SimpleClass;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of fields of PersistenceCapable class types
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-30.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of <code>PersistenceCapable</code>
+class types as First Class Objects.
+ */
+
+public class TestFieldsOfSimpleClass extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-30 (TestFieldsOfSimpleClass) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfSimpleClass.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            SimpleClass firstValue = new SimpleClass(100, "Hello");
+            SimpleClass secondValue = new SimpleClass(2000, "Hello World");
+            tx.begin();
+            FieldsOfSimpleClass pi = new FieldsOfSimpleClass();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0; i < n; ++i){
+                pi.set( i, firstValue);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            pi = (FieldsOfSimpleClass) pm.getObjectById(oid, true);
+            checkValues(oid, firstValue); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0; i < n; ++i){
+                pi.set(i, secondValue);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, secondValue);
+            pi = (FieldsOfSimpleClass) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, SimpleClass startValue){
+        int i;
+        FieldsOfSimpleClass pi = (FieldsOfSimpleClass) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0; i < n; ++i){
+            if( !FieldsOfSimpleClass.isPersistent[i] ) continue;
+            SimpleClass val = pi.get(i);
+            if(!val.equals(startValue) ){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfSimpleClass.fieldSpecs[i]);
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfSimpleClass.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfSimpleInterface.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfSimpleInterface.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfSimpleInterface.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfSimpleInterface.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfSimpleInterface;
+import org.apache.jdo.tck.pc.fieldtypes.SimpleClass;
+import org.apache.jdo.tck.pc.fieldtypes.SimpleInterface;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of interfaces as field type.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-32.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of interface types, and may choose
+to support them as Second Class Objects or First Class Objects.
+ */
+
+
+public class TestFieldsOfSimpleInterface extends JDO_Test {
+    
+   /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-32 (TestFieldsOfSimpleInterface) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfSimpleInterface.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            SimpleInterface firstValue = new SimpleClass(100, "Hello");
+            SimpleInterface secondValue = new SimpleClass(2000, "Hello World");
+            tx.begin();
+            FieldsOfSimpleInterface pi = new FieldsOfSimpleInterface();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0; i < n; ++i){
+                pi.set( i, firstValue);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            pi = (FieldsOfSimpleInterface) pm.getObjectById(oid, true);
+            checkValues(oid, firstValue); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0; i < n; ++i){
+                pi.set(i, secondValue);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, secondValue);
+            pi = (FieldsOfSimpleInterface) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, SimpleInterface startValue){
+        int i;
+        FieldsOfSimpleInterface pi = (FieldsOfSimpleInterface) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0; i < n; ++i){
+            if( !FieldsOfSimpleInterface.isPersistent[i] ) continue;
+            SimpleInterface val = pi.get(i);
+            if(!val.equals(startValue)){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfSimpleInterface.fieldSpecs[i]); 
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfSimpleInterface.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfString.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfString.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfString.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfString.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.FieldsOfString;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type String.
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-17.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of the immutable object class
+<code>java.lang.String</code>, and may choose to support them as
+Second Class Objects or First Class Objects.
+ */
+
+
+public class TestFieldsOfString extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-17 (TestFieldsOfString) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestFieldsOfString.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, n;
+            String firstValue = new String("Hello");
+            String secondValue = new String("Hello World");
+            tx.begin();
+            FieldsOfString pi = new FieldsOfString();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for( i = 0; i < n; ++i){
+                pi.set( i, firstValue);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            pi = (FieldsOfString) pm.getObjectById(oid, true);
+            checkValues(oid, firstValue); // check if persistent fields have values set
+
+            // Provide new set of values
+            for( i = 0; i < n; ++i){
+                pi.set(i, secondValue);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, secondValue);
+            pi = (FieldsOfString) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, String startValue){
+        int i;
+        String value;
+        FieldsOfString pi = (FieldsOfString) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0, value = startValue; i < n; ++i){
+            if( !FieldsOfString.isPersistent[i] ) continue;
+            String val = pi.get(i);
+            if(!val.equals(startValue) ){
+                fail(ASSERTION_FAILED,
+                        "Incorrect value for " + FieldsOfString.fieldSpecs[i] +
+                        ", expected value " + value +
+                        ", value is " + val.toString());
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfString.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashMapStringKeyCollections.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashMapStringKeyCollections.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashMapStringKeyCollections.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashMapStringKeyCollections.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,194 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.HashMapStringKeyCollections;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type HashMap, varying value type
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-24.
+ *<BR>
+ *<B>Assertion Description: </B>
+If the HashMap optional feature is supported, then JDO implementation must
+support fields of the mutable object class <code>HashMap</code>,
+supporting them as Second Class Objects or First Class Objects.
+ */
+
+
+public class TestHashMapStringKeyCollections extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-24 (TestHashMapStringKeyCollections) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestHashMapStringKeyCollections.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+         
+        runTest(pm);
+        
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    void runTest(PersistenceManager pm) 
+    {
+        if (!isHashMapSupported()) {
+            if (debug)
+                logger.debug("JDO Implementation does not support the optional feature HashMap");
+            return;
+        }
+        
+        Transaction tx = pm.currentTransaction();
+        try {
+            int i, j, n;
+            FirstSetOfTestValuesForCollection firstValue =
+                new FirstSetOfTestValuesForCollection();
+            SecondSetOfTestValuesForCollection secondValue =
+                new SecondSetOfTestValuesForCollection();
+        
+            // turn on datastore transactions
+            tx.setOptimistic(false);
+            tx.begin();
+            HashMapStringKeyCollections pi = new HashMapStringKeyCollections();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for(i = 0; i < n; ++i){
+                Vector fieldSpecs = TestUtil.getFieldSpecsForMap(HashMapStringKeyCollections.fieldSpecs[i]);
+                String fieldType = (String)fieldSpecs.get(0);
+                String valueType = (String)fieldSpecs.get(1);
+                HashMap map = new HashMap();
+                Vector keys = (Vector) firstValue.get(fieldType);
+                Vector values = (Vector) secondValue.get(valueType);
+
+                for (j = 0; j< keys.size(); j++) {
+                    map.put(keys.get(j), values.get(j));
+                }
+
+                pi.set(i, map);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            Hashtable firstSet = new Hashtable();
+            firstSet.put("keys", firstValue);
+            firstSet.put("values", secondValue);
+            pi = (HashMapStringKeyCollections) pm.getObjectById(oid, true);
+
+            checkValues(oid, firstSet); // check if persistent fields have values set
+
+            // Provide new set of values     -- reverse the keys and values
+            for(i = 0; i < n; ++i){
+                Vector fieldSpecs = TestUtil.getFieldSpecsForMap(HashMapStringKeyCollections.fieldSpecs[i]);
+                String fieldType = (String)fieldSpecs.get(0);
+                String valueType = (String)fieldSpecs.get(1);
+                HashMap map = new HashMap();
+                Vector keys = (Vector) secondValue.get(fieldType);
+                Vector values = (Vector) firstValue.get(valueType);
+
+                for (j = 0; j< keys.size(); j++) {
+                    map.put(keys.get(j), values.get(j));
+                }
+
+                pi.set(i, map);
+            }
+
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            Hashtable secondSet = new Hashtable();
+            secondSet.put("keys", secondValue);
+            secondSet.put("values", firstValue);
+
+            checkValues(oid, secondSet);
+            pi = (HashMapStringKeyCollections) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, Hashtable startValue)
+    {
+        int i, j;
+
+        HashMapStringKeyCollections pi = (HashMapStringKeyCollections) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+
+        Hashtable keySet = (Hashtable) startValue.get("keys");
+        Hashtable valueSet = (Hashtable) startValue.get("values");
+
+        for( i = 0; i < n; ++i){
+            Vector fieldSpecs = TestUtil.getFieldSpecsForMap(HashMapStringKeyCollections.fieldSpecs[i]);
+            String fieldType = (String)fieldSpecs.get(0);
+            String valueType = (String)fieldSpecs.get(1);
+            HashMap compareWith = new HashMap();
+
+            Vector keys = (Vector) keySet.get(fieldType);
+            Vector values = (Vector) valueSet.get(valueType);
+            
+            for (j = 0; j< keys.size(); j++) {
+                compareWith.put(keys.get(j), values.get(j));
+            }
+
+            HashMap val = pi.get(i);
+
+            if(!val.equals(compareWith)){
+                fail(ASSERTION_FAILED,
+                     "Incorrect value for " +HashMapStringKeyCollections.fieldSpecs[i]);
+            }
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashMapStringKeyCollections.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashMapStringValueCollections.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashMapStringValueCollections.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashMapStringValueCollections.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashMapStringValueCollections.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.HashMapStringValueCollections;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type HashMap, varying key type
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-24.
+ *<BR>
+ *<B>Assertion Description: </B>
+If the HashMap optional feature is supported, then JDO implementation must
+support fields of the mutable object class <code>HashMap</code>,
+supporting them as Second Class Objects or First Class Objects.
+ */
+
+public class TestHashMapStringValueCollections extends JDO_Test {
+
+   /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-24 (TestHashMapStringValueCollections) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestHashMapStringValueCollections.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+         
+        runTest(pm);
+        
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    void runTest(PersistenceManager pm) 
+    {
+        if (!isHashMapSupported()) {
+            if (debug)
+                logger.debug("JDO Implementation does not support the optional feature HashMap");
+            return;
+        }
+        
+        Transaction tx = pm.currentTransaction();
+        try { 
+            int i, j, n;
+            FirstSetOfTestValuesForCollection firstValue = 
+                    new FirstSetOfTestValuesForCollection();
+            SecondSetOfTestValuesForCollection secondValue = 
+                    new SecondSetOfTestValuesForCollection();
+
+            // turn on datastore transactions
+            tx.setOptimistic(false);
+            tx.begin();
+            HashMapStringValueCollections pi = new HashMapStringValueCollections();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for(i = 0; i < n; ++i){
+                Vector fieldSpecs = TestUtil.getFieldSpecsForMap(
+                    HashMapStringValueCollections.fieldSpecs[i]);
+                String fieldType = (String)fieldSpecs.get(0);
+                String valueType = (String)fieldSpecs.get(1);
+                HashMap map = new HashMap();
+                Vector keys = (Vector) firstValue.get(fieldType);
+                Vector values = (Vector) secondValue.get(valueType);
+
+                for (j = 0; j< keys.size(); j++) {
+                    map.put(keys.get(j), values.get(j));
+                }
+
+                pi.set(i, map);
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            Hashtable firstSet = new Hashtable();
+            firstSet.put("keys", firstValue);
+            firstSet.put("values", secondValue);
+
+            checkValues(oid, firstSet); // check if persistent fields have values set
+            pi = (HashMapStringValueCollections) pm.getObjectById(oid, true);
+
+            // Provide new set of values     -- reverse the keys and values
+            for(i = 0; i < n; ++i){
+                Vector fieldSpecs = TestUtil.getFieldSpecsForMap(
+                    HashMapStringValueCollections.fieldSpecs[i]);
+                String fieldType = (String)fieldSpecs.get(0);
+                String valueType = (String)fieldSpecs.get(1);
+                HashMap map = new HashMap();
+                Vector keys = (Vector) secondValue.get(fieldType);
+                Vector values = (Vector) firstValue.get(valueType);
+
+                for (j = 0; j< keys.size(); j++) {
+                    map.put(keys.get(j), values.get(j));
+                }
+
+                pi.set(i, map);
+            }
+
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            Hashtable secondSet = new Hashtable();
+            secondSet.put("keys", secondValue);
+            secondSet.put("values", firstValue);
+
+            checkValues(oid, secondSet);
+            pi = (HashMapStringValueCollections) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void checkValues(Object oid, Hashtable startValue)
+    {
+        int ret = 0;
+        int i, j;
+
+        HashMapStringValueCollections pi = 
+            (HashMapStringValueCollections) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+
+        Hashtable keySet = (Hashtable) startValue.get("keys");
+        Hashtable valueSet = (Hashtable) startValue.get("values");
+
+        for( i = 0; i < n; ++i){
+            Vector fieldSpecs = TestUtil.getFieldSpecsForMap(
+                HashMapStringValueCollections.fieldSpecs[i]);
+            String fieldType = (String)fieldSpecs.get(0);
+            String valueType = (String)fieldSpecs.get(1);
+            HashMap compareWith = new HashMap();
+
+            Vector keys = (Vector) keySet.get(fieldType);
+            Vector values = (Vector) valueSet.get(valueType);
+            
+            for (j = 0; j< keys.size(); j++) {
+                compareWith.put(keys.get(j), values.get(j));
+            }
+
+            HashMap val = pi.get(i);
+
+            if(!val.equals(compareWith)){
+                fail(ASSERTION_FAILED,
+                     "Incorrect value for " + HashMapStringValueCollections.fieldSpecs[i]);
+            }
+        }
+    }
+
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashMapStringValueCollections.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashSetCollections.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashSetCollections.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashSetCollections.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashSetCollections.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.jdo.tck.models.fieldtypes;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Hashtable;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.fieldtypes.HashSetCollections;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Support of field type HashSet
+ *<BR>
+ *<B>Keywords:</B> model
+ *<BR>
+ *<B>Assertion ID:</B> A6.4.3-22.
+ *<BR>
+ *<B>Assertion Description: </B>
+JDO implementations must support fields of the mutable object class
+<code>java.util.HashSet</code>, and may choose to support them as
+Second Class Objects or First Class Objects.
+ */
+
+
+public class TestHashSetCollections extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.4.3-22 (TestHashSetCollections) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(TestHashSetCollections.class);
+    }   
+
+    /** */
+    public void test() {
+        pm = getPM();
+         
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        try {
+            int i, n;
+            FirstSetOfTestValuesForCollection firstValue = new FirstSetOfTestValuesForCollection();
+            SecondSetOfTestValuesForCollection secondValue = new SecondSetOfTestValuesForCollection();
+
+            // turn on datastore transactions
+            tx.setOptimistic(false);
+            tx.begin();
+            HashSetCollections pi = new HashSetCollections();
+            pi.identifier = 1;
+            pm.makePersistent(pi);
+            Object oid = pm.getObjectId(pi);
+            n = pi.getLength();
+            // Provide initial set of values
+            for(i = 0; i < n; ++i){
+                String valueType = TestUtil.getFieldSpecs(HashSetCollections.fieldSpecs[i]);
+                pi.set( i, new HashSet((Collection)firstValue.get(valueType)));
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+
+            checkValues(oid, firstValue); // check if persistent fields have values set
+            pi = (HashSetCollections) pm.getObjectById(oid, true);
+
+            // Provide new set of values
+            for( i = 0; i < n; ++i){
+                String valueType = TestUtil.getFieldSpecs(HashSetCollections.fieldSpecs[i]);
+                pi.set( i, new HashSet((Collection)secondValue.get(valueType)));
+            }
+            tx.commit();
+            // cache will be flushed
+            pi = null;
+            System.gc();
+
+            tx.begin();
+            // check new values
+            checkValues(oid, secondValue);
+            pi = (HashSetCollections) pm.getObjectById(oid, true);
+            pm.deletePersistent(pi);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    private void checkValues(Object oid, Hashtable startValue)
+    {
+        int i;
+
+        HashSetCollections pi = (HashSetCollections) pm.getObjectById(oid, true);
+        int n = pi.getLength();
+        for( i = 0; i < n; ++i){
+            String valueType = TestUtil.getFieldSpecs(HashSetCollections.fieldSpecs[i]);
+            HashSet compareWith = new HashSet((Collection)startValue.get(valueType));
+
+            HashSet val = pi.get(i);
+
+            if(!val.equals(compareWith)){
+                fail(ASSERTION_FAILED,
+                     "Incorrect value for " + HashSetCollections.fieldSpecs[i]);
+            }
+        }
+    }
+
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashSetCollections.java
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message