You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mc...@apache.org on 2005/09/28 21:03:17 UTC
svn commit: r292259 [1/3] -
/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/
Author: mcaisse
Date: Wed Sep 28 12:03:07 2005
New Revision: 292259
URL: http://svn.apache.org/viewcvs?rev=292259&view=rev
Log:
JDO-143 JDO-145 JDO-151
Removed:
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/FirstSetOfTestValuesForCollection.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/SecondSetOfTestValuesForCollection.java
Modified:
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayListCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestCollectionCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBigDecimal.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBigInteger.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBoolean.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfByte.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfCharacter.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfDate.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfDouble.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfFloat.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfInteger.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLocale.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLong.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfObject.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveboolean.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivebyte.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivechar.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivedouble.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivefloat.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveint.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivelong.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveshort.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfShort.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfSimpleClass.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfSimpleInterface.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfString.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashMapStringKeyCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashMapStringValueCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashSetCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashtableStringKeyCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestHashtableStringValueCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestLinkedListCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestListCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestMapStringKeyCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestMapStringValueCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestSetCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestTreeMapStringKeyCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestTreeMapStringValueCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestTreeSetCollections.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestUtil.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestVectorCollections.java
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayCollections.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayCollections.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayCollections.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayCollections.java Wed Sep 28 12:03:07 2005
@@ -17,7 +17,7 @@
package org.apache.jdo.tck.models.fieldtypes;
import java.util.Arrays;
-import java.util.Hashtable;
+import java.util.Collection;
import java.util.Vector;
import javax.jdo.PersistenceManager;
@@ -75,17 +75,13 @@
{
if (!isArraySupported()) {
if (debug)
- logger.debug("JDO Implementation does not support optional feature Array");
+ logger.debug("JDO Implementation does not support" +
+ "optional feature Array");
return;
}
Transaction tx = pm.currentTransaction();
- try {
- int i, n;
- FirstSetOfTestValuesForCollection firstSetOfValues =
- new FirstSetOfTestValuesForCollection();
- SecondSetOfTestValuesForCollection secondSetOfValues =
- new SecondSetOfTestValuesForCollection();
+ ArrayCollections expectedValue = new ArrayCollections();
// turn on datastore transactions
tx.setOptimistic(false);
@@ -94,46 +90,23 @@
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(
- ArrayCollections.fieldSpecs[i]);
- //create an array of initial values for each value type
- Object[] firstValueArray = null;
- Vector firstValueVector = (Vector)firstSetOfValues.get(valueType);
- firstValueArray = (Object[])java.lang.reflect.Array.newInstance(firstValueVector.get(0).getClass(),
- firstValueVector.size());
- for (int j=0; j<firstValueVector.size(); j++) {
- firstValueArray[j] = firstValueVector.get(j);
- }
+ setValues(pi, 1);
- //set the initial set of values
- pi.set( i, firstValueArray);
- }
tx.commit();
// cache will be flushed
pi = null;
System.gc();
tx.begin();
+ setValues(expectedValue, 1);
- checkValues(oid, firstSetOfValues); // check if persistent fields have values set
+ // check if persistent fields have values set
+ checkValues(oid, expectedValue);
pi = (ArrayCollections) pm.getObjectById(oid, true);
// Provide new set of values
- for( i = 0; i < n; ++i){
- String valueType = TestUtil.getFieldSpecs(ArrayCollections.fieldSpecs[i]);
- //create an array of second set of values for each value type
- Object[] secondValueArray = null;
- Vector secondValueVector = (Vector)secondSetOfValues.get(valueType);
- secondValueArray = (Object[])java.lang.reflect.Array.newInstance(secondValueVector.get(0).getClass(),
- secondValueVector.size());
- for (int j=0; j<secondValueVector.size(); j++) {
- secondValueArray[j] = secondValueVector.get(j);
- }
- pi.set( i, secondValueArray);
- }
+ setValues(pi, 2);
tx.commit();
// cache will be flushed
pi = null;
@@ -141,54 +114,52 @@
tx.begin();
// check new values
- checkValues(oid, secondSetOfValues);
- pi = (ArrayCollections) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
+ setValues(expectedValue, 2);
+ checkValues(oid, expectedValue);
tx.commit();
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ }
+
+ /** */
+ private void setValues(ArrayCollections collect, int order)
+ {
+ Vector value;
+ int n = collect.getLength();
+ for (int i = 0; i < n; ++i) {
+ String valueType = TestUtil.getFieldSpecs(
+ ArrayCollections.fieldSpecs[i]);
+ Object[] valueArray = null;
+ value = TestUtil.makeNewVectorInstance(valueType, order);
+ value.copyInto(valueArray);
+ collect.set(i, valueArray);
+ if (debug)
+ logger.debug("Set " + i + "th value to: "
+ + valueArray.toString());
}
}
/** */
- private void checkValues(Object oid, Hashtable startValue)
+ private void checkValues(Object oid, ArrayCollections expectedValue)
{
- int i;
- int failedCount = 0;
+ StringBuffer sbuf = new StringBuffer();
ArrayCollections pi = (ArrayCollections) pm.getObjectById(oid, true);
int n = pi.getLength();
- for (i = 0; i < n; ++i) {
- String valueType = TestUtil.getFieldSpecs(ArrayCollections.fieldSpecs[i]);
- //build the compareWith array
- Object[] compareWith = null;
- Vector compareWithVector = (Vector)startValue.get(valueType);
- compareWith = (Object[])java.lang.reflect.Array.newInstance(compareWithVector.get(0).getClass(),
- compareWithVector.size());
- for (int j=0; j<compareWithVector.size(); j++) {
- compareWith[j] = compareWithVector.get(j);
+ for (int i = 0; i < n; ++i) {
+ Object [] compareWith = expectedValue.get(i);
+ Object [] val = pi.get(i);
+ if (val.length != compareWith.length) {
+ sbuf.append("\nFor element " + i + ", expected size = " +
+ compareWith.length + ", actual size = " + val.length
+ + " . ");
+ continue;
}
-
- Object[] val = pi.get(i);
-
- if(!Arrays.equals(val, compareWith)){
- failedCount++;
- if (debug) {
- logger.debug("checkValues comparison failed for field " + i);
- String message1 = compareWith==null?"unexpectedly null!!!":
- compareWith.toString();
- String message2 = val==null?"unexpectedly null!!!":
- val.toString();
- logger.debug("expected: " + message1);
- logger.debug("actual: "+ message2);
- }
+ if (! Arrays.equals(val, compareWith)) {
+ sbuf.append("\nFor element " + i + ", expected = " +
+ compareWith + ", actual = " + val + " . ");
}
}
- if (failedCount != 0) {
- fail(ASSERTION_FAILED,
- "TestArrayCollections " + failedCount + " fields failed to compare.");
+ if (sbuf.length() > 0) {
+ fail(ASSERTION_FAILED,
+ "Expected and observed do not match!!" + sbuf.toString());
}
}
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayListCollections.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayListCollections.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayListCollections.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestArrayListCollections.java Wed Sep 28 12:03:07 2005
@@ -18,7 +18,7 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Hashtable;
+import java.util.Vector;
import javax.jdo.PersistenceManager;
import javax.jdo.Transaction;
@@ -77,81 +77,89 @@
{
if (!isArrayListSupported()) {
if (debug)
- logger.debug("JDO Implementation does not support optional feature ArrayList");
+ logger.debug("JDO Implementation does not support optional " +
+ "feature ArrayList");
return;
}
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();
- ArrayListCollections pi = new ArrayListCollections();
- 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(ArrayListCollections.fieldSpecs[i]);
- pi.set( i, new ArrayList((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 = (ArrayListCollections) pm.getObjectById(oid, true);
-
- // Provide new set of values
- for( i = 0; i < n; ++i){
- String valueType = TestUtil.getFieldSpecs(ArrayListCollections.fieldSpecs[i]);
- pi.set( i, new ArrayList((Collection)secondValue.get(valueType)));
- }
- tx.commit();
- // cache will be flushed
- pi = null;
- System.gc();
-
- tx.begin();
- // check new values
- checkValues(oid, secondValue);
- pi = (ArrayListCollections) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
- tx.commit();
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ ArrayListCollections expectedValue = new ArrayListCollections();
+
+ // turn on datastore transactions
+ tx.setOptimistic(false);
+ tx.begin();
+ ArrayListCollections pi = new ArrayListCollections();
+ pi.identifier = 1;
+ pm.makePersistent(pi);
+ Object oid = pm.getObjectId(pi);
+ // Provide initial set of values
+ setValues(pi, 1);
+ tx.commit();
+ // cache will be flushed
+ pi = null;
+ System.gc();
+
+ tx.begin();
+
+ setValues(expectedValue, 1);
+ checkValues(oid, expectedValue);
+ pi = (ArrayListCollections) pm.getObjectById(oid, true);
+
+ // Provide new set of values
+ setValues(pi, 2);
+ tx.commit();
+ // cache will be flushed
+ pi = null;
+ System.gc();
+
+ tx.begin();
+ // check new values
+ setValues(expectedValue, 2);
+ checkValues(oid, expectedValue);
+ tx.commit();
+ }
+
+ /** */
+ private void setValues(ArrayListCollections collect, int order)
+ {
+ Collection value;
+ int n = collect.getLength();
+ for (int i = 0; i < n; ++i) {
+ String valueType = TestUtil.getFieldSpecs(
+ ArrayListCollections.fieldSpecs[i]);
+ value = (Collection)TestUtil.makeNewVectorInstance(
+ valueType, order);
+ collect.set(i, (ArrayList) value);
+ if (debug)
+ logger.debug("Set " + i + "th value to: " + value.toString());
}
}
/** */
- private void checkValues(Object oid, Hashtable startValue)
+ private void checkValues(Object oid, ArrayListCollections expectedValue)
{
int i;
- ArrayListCollections pi = (ArrayListCollections) pm.getObjectById(oid, true);
+ StringBuffer sbuf = new StringBuffer();
+ ArrayListCollections pi = (ArrayListCollections)
+ pm.getObjectById(oid, true);
int n = pi.getLength();
- for( i = 0; i < n; ++i){
- String valueType = TestUtil.getFieldSpecs(ArrayListCollections.fieldSpecs[i]);
- ArrayList compareWith = new ArrayList((Collection)startValue.get(valueType));
-
- ArrayList val = pi.get(i);
-
- if(!val.equals(compareWith)){
- fail(ASSERTION_FAILED,
- "Incorrect value for " + ArrayListCollections.fieldSpecs[i]);
+ for (i = 0; i < n; ++i) {
+ Collection compareWith = expectedValue.get(i);
+ Collection val = pi.get(i);
+ if (val.size() != compareWith.size()) {
+ sbuf.append("\nFor element " + i + ", expected size = " +
+ compareWith.size() + ", actual size = " + val.size()
+ + " . ");
+ continue;
+ }
+ if (! val.equals(compareWith)) {
+ sbuf.append("\nFor element " + i + ", expected = " +
+ compareWith + ", actual = " + val + " . ");
}
+ }
+ if (sbuf.length() > 0) {
+ fail(ASSERTION_FAILED,
+ "Expected and observed do not match!!" + sbuf.toString());
}
}
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestCollectionCollections.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestCollectionCollections.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestCollectionCollections.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestCollectionCollections.java Wed Sep 28 12:03:07 2005
@@ -17,6 +17,7 @@
package org.apache.jdo.tck.models.fieldtypes;
import java.util.Collection;
+import java.util.Vector;
import java.util.Hashtable;
import javax.jdo.PersistenceManager;
@@ -76,76 +77,82 @@
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();
- CollectionCollections pi = new CollectionCollections();
- 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(CollectionCollections.fieldSpecs[i]);
- pi.set( i, (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 = (CollectionCollections) pm.getObjectById(oid, true);
-
- // Provide new set of values
- for( i = 0; i < n; ++i){
- String valueType = TestUtil.getFieldSpecs(CollectionCollections.fieldSpecs[i]);
- pi.set( i, (Collection)secondValue.get(valueType));
-
- }
- tx.commit();
- // cache will be flushed
- pi = null;
- System.gc();
-
- tx.begin();
- // check new values
- checkValues(oid, secondValue);
- pi = (CollectionCollections) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
- tx.commit();
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ CollectionCollections expectedValue = new CollectionCollections();
+
+ // turn on datastore transactions
+ tx.setOptimistic(false);
+ tx.begin();
+ CollectionCollections pi = new CollectionCollections();
+ pi.identifier = 1;
+ pm.makePersistent(pi);
+ Object oid = pm.getObjectId(pi);
+ // Provide initial set of values
+ setValues(pi, 1);
+ tx.commit();
+
+ // cache will be flushed
+ pi = null;
+ System.gc();
+
+ tx.begin();
+ setValues(expectedValue, 1);
+ // check if persistent fields have values set
+ checkValues(oid, expectedValue);
+ pi = (CollectionCollections) pm.getObjectById(oid, true);
+ // Provide new set of values
+ setValues(pi, 2);
+ tx.commit();
+
+ // cache will be flushed
+ pi = null;
+ System.gc();
+
+ tx.begin();
+ // check new values
+ setValues(expectedValue, 2);
+ checkValues(oid, expectedValue);
+ tx.commit();
+ }
+
+ /** */
+ private void setValues(CollectionCollections colcol, int order)
+ {
+ Vector value;
+ int n = colcol.getLength();
+ for (int i = 0; i < n; ++i) {
+ String valueType = TestUtil.getFieldSpecs(
+ CollectionCollections.fieldSpecs[i]);
+ value = TestUtil.makeNewVectorInstance(valueType, order);
+ colcol.set(i, value);
+ if (debug)
+ logger.debug("Set " + i + "th value to: " + value.toString());
}
}
/** */
- private void checkValues(Object oid, Hashtable startValue)
+ private void checkValues(Object oid, CollectionCollections expectedValue)
{
- int ret = 0;
- int i;
- Collection value;
- CollectionCollections pi = (CollectionCollections) pm.getObjectById(oid, true);
+ StringBuffer sbuf = new StringBuffer();
+ CollectionCollections pi = (CollectionCollections)
+ pm.getObjectById(oid, true);
int n = pi.getLength();
- for( i = 0; i < n; ++i){
- String valueType = TestUtil.getFieldSpecs(CollectionCollections.fieldSpecs[i]);
- Collection compareWith = (Collection)startValue.get(valueType);
-
+ for (int i = 0; i < n; ++i) {
+ Collection compareWith = expectedValue.get(i);
Collection val = pi.get(i);
- if(! val.equals(compareWith) ){
- fail(ASSERTION_FAILED,
- "Incorrect value for " + CollectionCollections.fieldSpecs[i]);
+ if (val.size() != compareWith.size()) {
+ sbuf.append("\nFor element " + i + ", expected size = " +
+ compareWith.size() + ", actual size = " + val.size()
+ + " . ");
+ continue;
}
+ if (! val.equals(compareWith)) {
+ sbuf.append("\nFor element " + i + ", expected = " +
+ compareWith + ", actual = " + val + " . ");
+ }
+ }
+ if (sbuf.length() > 0) {
+ fail(ASSERTION_FAILED,
+ "Expected and observed do not match!!" + sbuf.toString());
}
}
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBigDecimal.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBigDecimal.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBigDecimal.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBigDecimal.java Wed Sep 28 12:03:07 2005
@@ -74,57 +74,46 @@
void runTest(PersistenceManager pm)
{
Transaction tx = pm.currentTransaction();
- try {
- int i, n;
- BigDecimal firstValue = new BigDecimal("20079.0237");
- BigDecimal secondValue = new BigDecimal("8907489.658");
- int ret = 0;
- tx.begin();
- FieldsOfBigDecimal pi = new FieldsOfBigDecimal();
- 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();
+ int i, n;
+ BigDecimal firstValue = new BigDecimal("20079.0237");
+ BigDecimal secondValue = new BigDecimal("8907489.658");
+ tx.begin();
+ FieldsOfBigDecimal pi = new FieldsOfBigDecimal();
+ 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();
- pi = (FieldsOfBigDecimal) pm.getObjectById(oid, true);
- checkValues(oid, firstValue); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfBigDecimal) pm.getObjectById(oid, true);
+ checkValues(oid, firstValue);
- tx.begin();
- // check new values
- checkValues(oid, secondValue);
- pi = (FieldsOfBigDecimal) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
- tx.commit();
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ // 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);
+ tx.commit();
}
/** */
private void checkValues(Object oid, BigDecimal startValue){
- int ret = 0;
int i;
BigDecimal value;
FieldsOfBigDecimal pi = (FieldsOfBigDecimal) pm.getObjectById(oid, true);
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBigInteger.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBigInteger.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBigInteger.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBigInteger.java Wed Sep 28 12:03:07 2005
@@ -74,56 +74,46 @@
void runTest(PersistenceManager pm)
{
Transaction tx = pm.currentTransaction();
- try {
- int i, n;
- BigInteger firstValue = new BigInteger("2007908");
- BigInteger secondValue = new BigInteger("896738");
- tx.begin();
- FieldsOfBigInteger pi = new FieldsOfBigInteger();
- 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();
+ int i, n;
+ BigInteger firstValue = new BigInteger("2007908");
+ BigInteger secondValue = new BigInteger("896738");
+ tx.begin();
+ FieldsOfBigInteger pi = new FieldsOfBigInteger();
+ 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();
- pi = (FieldsOfBigInteger) pm.getObjectById(oid, true);
- checkValues(oid, firstValue); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfBigInteger) pm.getObjectById(oid, true);
+ checkValues(oid, firstValue);
- tx.begin();
- // check new values
- checkValues(oid, secondValue);
- pi = (FieldsOfBigInteger) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
- tx.commit();
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ // 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);
+ tx.commit();
}
/** */
private void checkValues(Object oid, BigInteger startValue){
- int ret = 0;
int i;
BigInteger value = startValue;
FieldsOfBigInteger pi = (FieldsOfBigInteger) pm.getObjectById(oid, true);
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBoolean.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBoolean.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBoolean.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfBoolean.java Wed Sep 28 12:03:07 2005
@@ -72,51 +72,42 @@
void runTest(PersistenceManager pm)
{
Transaction tx = pm.currentTransaction();
- try {
- int i, n;
- Boolean firstValue = new Boolean(true);
- Boolean secondValue = new Boolean(false);
- tx.begin();
- FieldsOfBoolean pi = new FieldsOfBoolean();
- 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();
+ int i, n;
+ Boolean firstValue = new Boolean(true);
+ Boolean secondValue = new Boolean(false);
+ tx.begin();
+ FieldsOfBoolean pi = new FieldsOfBoolean();
+ 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();
- pi = (FieldsOfBoolean) pm.getObjectById(oid, true);
- checkValues(oid, firstValue); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfBoolean) pm.getObjectById(oid, true);
+ checkValues(oid, firstValue);
- tx.begin();
- // check new values
- checkValues(oid, secondValue);
- pi = (FieldsOfBoolean) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
- tx.commit();
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ // 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);
+ tx.commit();
}
/** */
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfByte.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfByte.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfByte.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfByte.java Wed Sep 28 12:03:07 2005
@@ -73,51 +73,42 @@
void runTest(PersistenceManager pm)
{
Transaction tx = pm.currentTransaction();
- try {
- int i, n;
- Byte firstValue = new Byte((byte)Byte.MIN_VALUE);
- Byte secondValue = new Byte((byte)Byte.MAX_VALUE);
- tx.begin();
- FieldsOfByte pi = new FieldsOfByte();
- 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();
+ int i, n;
+ Byte firstValue = new Byte((byte)Byte.MIN_VALUE);
+ Byte secondValue = new Byte((byte)Byte.MAX_VALUE);
+ tx.begin();
+ FieldsOfByte pi = new FieldsOfByte();
+ 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();
- pi = (FieldsOfByte) pm.getObjectById(oid, true);
- checkValues(oid, firstValue); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfByte) pm.getObjectById(oid, true);
+ checkValues(oid, firstValue);
- tx.begin();
- // check new values
- checkValues(oid, secondValue);
- pi = (FieldsOfByte) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
- tx.commit();
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ // 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);
+ tx.commit();
}
/** */
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfCharacter.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfCharacter.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfCharacter.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfCharacter.java Wed Sep 28 12:03:07 2005
@@ -73,51 +73,42 @@
void runTest(PersistenceManager pm)
{
Transaction tx = pm.currentTransaction();
- try {
- int i, n;
- Character firstValue = new Character((char)Character.MIN_VALUE);
- Character secondValue = new Character((char)Character.MAX_VALUE);
- tx.begin();
- FieldsOfCharacter pi = new FieldsOfCharacter();
- 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();
+ int i, n;
+ Character firstValue = new Character((char)Character.MIN_VALUE);
+ Character secondValue = new Character((char)Character.MAX_VALUE);
+ tx.begin();
+ FieldsOfCharacter pi = new FieldsOfCharacter();
+ 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();
- pi = (FieldsOfCharacter) pm.getObjectById(oid, true);
- checkValues(oid, firstValue); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfCharacter) pm.getObjectById(oid, true);
+ checkValues(oid, firstValue);
- tx.begin();
- // check new values
- checkValues(oid, secondValue);
- pi = (FieldsOfCharacter) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
- tx.commit();
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ // 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);
+ tx.commit();
}
/** */
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfDate.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfDate.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfDate.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfDate.java Wed Sep 28 12:03:07 2005
@@ -74,51 +74,42 @@
void runTest(PersistenceManager pm)
{
Transaction tx = pm.currentTransaction();
- try {
- int i, n;
- Date firstValue = new Date(2007908);
- Date secondValue = new Date(890748967382l);
- tx.begin();
- FieldsOfDate pi = new FieldsOfDate();
- 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();
+ int i, n;
+ Date firstValue = new Date(2007908);
+ Date secondValue = new Date(890748967382l);
+ tx.begin();
+ FieldsOfDate pi = new FieldsOfDate();
+ 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();
- pi = (FieldsOfDate) pm.getObjectById(oid, true);
- checkValues(oid, firstValue); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfDate) pm.getObjectById(oid, true);
+ checkValues(oid, firstValue);
- tx.begin();
- // check new values
- checkValues(oid, secondValue);
- pi = (FieldsOfDate) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
- tx.commit();
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ // 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);
+ tx.commit();
}
/** */
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfDouble.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfDouble.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfDouble.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfDouble.java Wed Sep 28 12:03:07 2005
@@ -73,51 +73,42 @@
void runTest(PersistenceManager pm)
{
Transaction tx = pm.currentTransaction();
- try {
- int i, n;
- Double firstValue = new Double(AllTypes.DOUBLE_SMALLEST);
- Double secondValue = new Double(AllTypes.DOUBLE_LARGEST);
- tx.begin();
- FieldsOfDouble pi = new FieldsOfDouble();
- 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();
+ int i, n;
+ Double firstValue = new Double(AllTypes.DOUBLE_SMALLEST);
+ Double secondValue = new Double(AllTypes.DOUBLE_LARGEST);
+ tx.begin();
+ FieldsOfDouble pi = new FieldsOfDouble();
+ 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();
- pi = (FieldsOfDouble) pm.getObjectById(oid, true);
- checkValues(oid, firstValue); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfDouble) pm.getObjectById(oid, true);
+ checkValues(oid, firstValue);
- tx.begin();
- // check new values
- checkValues(oid, secondValue);
- pi = (FieldsOfDouble) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
- tx.commit();
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ // 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);
+ tx.commit();
}
/** */
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfFloat.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfFloat.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfFloat.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfFloat.java Wed Sep 28 12:03:07 2005
@@ -74,52 +74,42 @@
void runTest(PersistenceManager pm)
{
Transaction tx = pm.currentTransaction();
- try {
- int i, n;
- Float firstValue = new Float(AllTypes.FLOAT_SMALLEST);
- Float secondValue = new Float(AllTypes.FLOAT_LARGEST);
- tx.begin();
- FieldsOfFloat pi = new FieldsOfFloat();
- 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();
+ int i, n;
+ Float firstValue = new Float(AllTypes.FLOAT_SMALLEST);
+ Float secondValue = new Float(AllTypes.FLOAT_LARGEST);
+ tx.begin();
+ FieldsOfFloat pi = new FieldsOfFloat();
+ 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();
- pi = (FieldsOfFloat) pm.getObjectById(oid, true);
- checkValues(oid, firstValue); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfFloat) pm.getObjectById(oid, true);
+ checkValues(oid, firstValue);
- tx.begin();
- // check new values
- checkValues(oid, secondValue);
- pi = (FieldsOfFloat) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
- tx.commit();
-
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ // 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);
+ tx.commit();
}
/** */
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfInteger.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfInteger.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfInteger.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfInteger.java Wed Sep 28 12:03:07 2005
@@ -72,51 +72,42 @@
void runTest(PersistenceManager pm)
{
Transaction tx = pm.currentTransaction();
- try {
- int i, n;
- Integer firstValue = new Integer(Integer.MIN_VALUE);
- Integer secondValue = new Integer(Integer.MAX_VALUE);
- tx.begin();
- FieldsOfInteger pi = new FieldsOfInteger();
- 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();
+ int i, n;
+ Integer firstValue = new Integer(Integer.MIN_VALUE);
+ Integer secondValue = new Integer(Integer.MAX_VALUE);
+ tx.begin();
+ FieldsOfInteger pi = new FieldsOfInteger();
+ 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();
- pi = (FieldsOfInteger) pm.getObjectById(oid, true);
- checkValues(oid, firstValue); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfInteger) pm.getObjectById(oid, true);
+ checkValues(oid, firstValue);
- tx.begin();
- // check new values
- checkValues(oid, secondValue);
- pi = (FieldsOfInteger) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
- tx.commit();
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ // 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);
+ tx.commit();
}
/** */
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLocale.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLocale.java?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLocale.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLocale.java Wed Sep 28 12:03:07 2005
@@ -74,51 +74,42 @@
void runTest(PersistenceManager pm)
{
Transaction tx = pm.currentTransaction();
- try {
- int i, n;
- Locale firstValue = Locale.CHINA;
- Locale secondValue = Locale.JAPANESE;
- tx.begin();
- FieldsOfLocale pi = new FieldsOfLocale();
- 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();
+ int i, n;
+ Locale firstValue = Locale.CHINA;
+ Locale secondValue = Locale.JAPANESE;
+ tx.begin();
+ FieldsOfLocale pi = new FieldsOfLocale();
+ 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();
- pi = (FieldsOfLocale) pm.getObjectById(oid, true);
- checkValues(oid, firstValue); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfLocale) pm.getObjectById(oid, true);
+ checkValues(oid, firstValue);
- tx.begin();
- // check new values
- checkValues(oid, secondValue);
- pi = (FieldsOfLocale) pm.getObjectById(oid, true);
- pm.deletePersistent(pi);
- tx.commit();
- tx = null;
- }
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ // 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);
+ tx.commit();
}
/** */
Modified: 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?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLong.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfLong.java Wed Sep 28 12:03:07 2005
@@ -73,51 +73,42 @@
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();
+ 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();
- pi = (FieldsOfLong) pm.getObjectById(oid, true);
- checkValues(oid, firstValue); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfLong) pm.getObjectById(oid, true);
+ checkValues(oid, firstValue);
- 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();
+ // 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);
+ tx.commit();
}
/** */
Modified: 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?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfObject.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfObject.java Wed Sep 28 12:03:07 2005
@@ -76,50 +76,41 @@
void runTest(PersistenceManager pm)
{
Transaction tx = pm.currentTransaction();
- try {
- int i, n;
- Object firstValue = new SimpleClass(1, "Hello");
- Object secondValue = new SimpleClass(333, "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
+ int i, n;
+ Object firstValue = new SimpleClass(1, "Hello");
+ Object secondValue = new SimpleClass(333, "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();
- // 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();
+ pi = (FieldsOfObject) pm.getObjectById(oid, true);
+ checkValues(oid, firstValue);
- 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();
+ // 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);
+ tx.commit();
}
/** */
Modified: 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?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveboolean.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveboolean.java Wed Sep 28 12:03:07 2005
@@ -70,63 +70,56 @@
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();
+ 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();
- pi = (FieldsOfPrimitiveboolean) pm.getObjectById(oid, true);
- checkValues(oid, true); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfPrimitiveboolean) pm.getObjectById(oid, true);
+ checkValues(oid, true);
- 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();
+ // 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);
+ tx.commit();
}
/** */
private void checkValues(Object oid, boolean startValue){
int i;
- FieldsOfPrimitiveboolean pi = (FieldsOfPrimitiveboolean) pm.getObjectById(oid, true);
+ 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] +
+ "Incorrect value for " +
+ FieldsOfPrimitiveboolean.fieldSpecs[i] +
", expected value " + startValue +
", value is " + val);
}
Modified: 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?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivebyte.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivebyte.java Wed Sep 28 12:03:07 2005
@@ -71,63 +71,56 @@
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();
+ 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();
- pi = (FieldsOfPrimitivebyte) pm.getObjectById(oid, true);
- checkValues(oid, (byte)10); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfPrimitivebyte) pm.getObjectById(oid, true);
+ checkValues(oid, (byte)10);
- 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();
+ // 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);
+ tx.commit();
}
/** */
private void checkValues(Object oid, byte startValue){
int i;
- FieldsOfPrimitivebyte pi = (FieldsOfPrimitivebyte) pm.getObjectById(oid, true);
+ 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] +
+ "Incorrect value for " +
+ FieldsOfPrimitivebyte.fieldSpecs[i] +
", expected value " + startValue +
", value is " + val);
}
Modified: 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?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivechar.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivechar.java Wed Sep 28 12:03:07 2005
@@ -71,63 +71,56 @@
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();
+ 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();
- pi = (FieldsOfPrimitivechar) pm.getObjectById(oid, true);
- checkValues(oid, 'a'); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfPrimitivechar) pm.getObjectById(oid, true);
+ checkValues(oid, 'a'); // check if persistent fields have values set
- 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();
+ // 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');
+ tx.commit();
}
/** */
private void checkValues(Object oid, char startValue){
int i;
- FieldsOfPrimitivechar pi = (FieldsOfPrimitivechar) pm.getObjectById(oid, true);
+ 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] +
+ "Incorrect value for " +
+ FieldsOfPrimitivechar.fieldSpecs[i] +
", expected value " + startValue +
", value is " + val);
}
Modified: 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?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivedouble.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivedouble.java Wed Sep 28 12:03:07 2005
@@ -71,63 +71,56 @@
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();
+ 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();
- pi = (FieldsOfPrimitivedouble) pm.getObjectById(oid, true);
- checkValues(oid, (double)10.15); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfPrimitivedouble) pm.getObjectById(oid, true);
+ checkValues(oid, (double)10.15);
- 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();
+ // 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);
+ tx.commit();
}
/** */
private void checkValues(Object oid, double startValue){
int i;
- FieldsOfPrimitivedouble pi = (FieldsOfPrimitivedouble) pm.getObjectById(oid, true);
+ 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] +
+ "Incorrect value for " +
+ FieldsOfPrimitivedouble.fieldSpecs[i] +
", expected value " + startValue +
", value is " + val);
}
Modified: 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?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivefloat.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitivefloat.java Wed Sep 28 12:03:07 2005
@@ -71,63 +71,56 @@
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();
+ 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();
- pi = (FieldsOfPrimitivefloat) pm.getObjectById(oid, true);
- checkValues(oid, (float)10.15); // check if persistent fields have values set
+ tx.begin();
- // 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();
+ pi = (FieldsOfPrimitivefloat) pm.getObjectById(oid, true);
+ checkValues(oid, (float)10.15);
- 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();
+ // 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);
+ tx.commit();
}
/** */
private void checkValues(Object oid, float startValue){
int i;
- FieldsOfPrimitivefloat pi = (FieldsOfPrimitivefloat) pm.getObjectById(oid, true);
+ 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] +
+ "Incorrect value for " +
+ FieldsOfPrimitivefloat.fieldSpecs[i] +
", expected value " + startValue +
", value is " + val);
}
Modified: 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?rev=292259&r1=292258&r2=292259&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveint.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/fieldtypes/TestFieldsOfPrimitiveint.java Wed Sep 28 12:03:07 2005
@@ -71,61 +71,54 @@
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;
+ 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);
}
- finally {
- if ((tx != null) && tx.isActive())
- tx.rollback();
+ 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);
+ tx.commit();
}
/** */
private void checkValues(Object oid, int startValue){
int i, value;
- FieldsOfPrimitiveint pi = (FieldsOfPrimitiveint) pm.getObjectById(oid, true);
+ 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] +
+ "Incorrect value for " +
+ FieldsOfPrimitiveint.fieldSpecs[i] +
", expected value " + startValue +
", value is " + val);
}