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 mb...@apache.org on 2021/04/28 21:48:32 UTC
[db-jdo] branch JDO-709 updated: JDO-709: Renamed PCRect2 to
PCRectString, removed debug logging
This is an automated email from the ASF dual-hosted git repository.
mbo pushed a commit to branch JDO-709
in repository https://gitbox.apache.org/repos/asf/db-jdo.git
The following commit(s) were added to refs/heads/JDO-709 by this push:
new b46cdb0 JDO-709: Renamed PCRect2 to PCRectString, removed debug logging
b46cdb0 is described below
commit b46cdb00fa219b020c0ef8202fba1ad37d899d31
Author: Michael Bouschen <mb...@apache.org>
AuthorDate: Wed Apr 28 23:48:21 2021 +0200
JDO-709: Renamed PCRect2 to PCRectString, removed debug logging
---
.../tck/api/converter/AttributeConverterTest.java | 68 +++++++++++-----------
.../pc/mylib/{PCRect2.java => PCRectString.java} | 18 +++---
tck/src/main/resources/conf/jdori-log4j2.xml | 2 +-
.../org/apache/jdo/tck/pc/mylib/package.jdo | 8 +--
.../org/apache/jdo/tck/pc/mylib/package.jdo | 6 +-
.../apache/jdo/tck/pc/mylib/package-standard.orm | 2 +-
.../apache/jdo/tck/pc/mylib/package-standard.orm | 2 +-
.../sql/derby/applicationidentity/schema.sql | 4 +-
.../sql/derby/datastoreidentity/schema.sql | 4 +-
9 files changed, 57 insertions(+), 57 deletions(-)
diff --git a/tck/src/main/java/org/apache/jdo/tck/api/converter/AttributeConverterTest.java b/tck/src/main/java/org/apache/jdo/tck/api/converter/AttributeConverterTest.java
index 969d442..4339d37 100644
--- a/tck/src/main/java/org/apache/jdo/tck/api/converter/AttributeConverterTest.java
+++ b/tck/src/main/java/org/apache/jdo/tck/api/converter/AttributeConverterTest.java
@@ -17,7 +17,7 @@
package org.apache.jdo.tck.api.converter;
import org.apache.jdo.tck.JDO_Test;
-import org.apache.jdo.tck.pc.mylib.PCRect2;
+import org.apache.jdo.tck.pc.mylib.PCRectString;
import org.apache.jdo.tck.pc.mylib.Point;
import org.apache.jdo.tck.util.BatchTestRunner;
@@ -55,57 +55,57 @@ public class AttributeConverterTest extends JDO_Test {
*/
@Override
protected void localSetUp() {
- addTearDownClass(PCRect2.class);
+ addTearDownClass(PCRectString.class);
}
/**
- * Test method creating a PCRect2 instance and reading it back from the datastore.
- * A PCRect2 instance refers two Point instances, that are stored as strings in the datastore.
+ * Test method creating a PCRectString instance and reading it back from the datastore.
+ * A PCRectString instance refers two Point instances, that are stored as strings in the datastore.
* A Point instance is converted using an AttributeConverter.
*/
- public void testCreatePCRect2Instance() {
+ public void testCreatePCRectStringInstance() {
Transaction tx;
- PCRect2 rect;
+ PCRectString rect;
Object oid;
int nrOfDbCalls;
int nrOfAttrCalls;
// Test: AttributeConverter method convertToDatastore is called when persisting instance
- nrOfDbCalls = PCRect2.PointToStringConverter.getNrOfConvertToDatastoreCalls();
- nrOfAttrCalls = PCRect2.PointToStringConverter.getNrOfConvertToAttributeCalls();
+ nrOfDbCalls = PCRectString.PointToStringConverter.getNrOfConvertToDatastoreCalls();
+ nrOfAttrCalls = PCRectString.PointToStringConverter.getNrOfConvertToAttributeCalls();
pm = getPM();
tx = pm.currentTransaction();
tx.begin();
- // Create a persistent PCRect2 instance and store its oid
- rect = new PCRect2(new Point(UL_X, UL_Y), new Point(LR_X, LR_Y));
+ // Create a persistent PCRectString instance and store its oid
+ rect = new PCRectString(new Point(UL_X, UL_Y), new Point(LR_X, LR_Y));
pm.makePersistent(rect);
oid = pm.getObjectId(rect);
tx.commit();
// convertToDatastore should be called twice
- assertEquals(2, PCRect2.PointToStringConverter.getNrOfConvertToDatastoreCalls() - nrOfDbCalls);
+ assertEquals(2, PCRectString.PointToStringConverter.getNrOfConvertToDatastoreCalls() - nrOfDbCalls);
// convertToAttribute should not be called
- assertEquals(0, PCRect2.PointToStringConverter.getNrOfConvertToAttributeCalls() - nrOfAttrCalls);
+ assertEquals(0, PCRectString.PointToStringConverter.getNrOfConvertToAttributeCalls() - nrOfAttrCalls);
// Cleanup the 2nd-level cache and close the pm to make sure PCRect instances are not cached
- pm.getPersistenceManagerFactory().getDataStoreCache().evictAll(false, PCRect2.class);
+ pm.getPersistenceManagerFactory().getDataStoreCache().evictAll(false, PCRectString.class);
pm.close();
pm = null;
// Test: AttributeConverter method convertToAttribute is called when loading instance from the datastore
- nrOfDbCalls = PCRect2.PointToStringConverter.getNrOfConvertToDatastoreCalls();
- nrOfAttrCalls = PCRect2.PointToStringConverter.getNrOfConvertToAttributeCalls();
+ nrOfDbCalls = PCRectString.PointToStringConverter.getNrOfConvertToDatastoreCalls();
+ nrOfAttrCalls = PCRectString.PointToStringConverter.getNrOfConvertToAttributeCalls();
pm = getPM();
tx = pm.currentTransaction();
tx.begin();
- // Read the PCRect2 instance from the datastore
- rect = (PCRect2)pm.getObjectById(oid);
+ // Read the PCRectString instance from the datastore
+ rect = (PCRectString)pm.getObjectById(oid);
Point ul = rect.getUpperLeft();
Point lr = rect.getLowerRight();
tx.commit();
// convertToDatastore should not be called
- assertEquals(0, PCRect2.PointToStringConverter.getNrOfConvertToDatastoreCalls() - nrOfDbCalls);
+ assertEquals(0, PCRectString.PointToStringConverter.getNrOfConvertToDatastoreCalls() - nrOfDbCalls);
// convertToAttribute should be called twice
- assertEquals(2, PCRect2.PointToStringConverter.getNrOfConvertToAttributeCalls() - nrOfAttrCalls);
+ assertEquals(2, PCRectString.PointToStringConverter.getNrOfConvertToAttributeCalls() - nrOfAttrCalls);
// Check the coordinates of the associated Point instances
assertEquals(UL_X, ul.getX());
@@ -119,43 +119,43 @@ public class AttributeConverterTest extends JDO_Test {
* This parameter value is converted using the AttributeConverter.
* @throws Exception
*/
- public void testQueryPCRect2Instance() throws Exception {
+ public void testQueryPCRectStringInstance() throws Exception {
Transaction tx;
int nrOfDbCalls;
int nrOfAttrCalls;
// Test: AttributeConverter method convertToDatastore is called when persisting instances
- nrOfDbCalls = PCRect2.PointToStringConverter.getNrOfConvertToDatastoreCalls();
- nrOfAttrCalls = PCRect2.PointToStringConverter.getNrOfConvertToAttributeCalls();
+ nrOfDbCalls = PCRectString.PointToStringConverter.getNrOfConvertToDatastoreCalls();
+ nrOfAttrCalls = PCRectString.PointToStringConverter.getNrOfConvertToAttributeCalls();
pm = getPM();
tx = pm.currentTransaction();
tx.begin();
- // create 5 persistent PCRect2 instances
+ // create 5 persistent PCRectString instances
for (int i = 0; i < 5; i++) {
- pm.makePersistent(new PCRect2(new Point(UL_X + i, UL_Y + i), new Point(LR_X + i, LR_Y + i)));
+ pm.makePersistent(new PCRectString(new Point(UL_X + i, UL_Y + i), new Point(LR_X + i, LR_Y + i)));
}
tx.commit();
// convertToDatastore should be called twice per instance = 10 times
- assertEquals(10, PCRect2.PointToStringConverter.getNrOfConvertToDatastoreCalls() - nrOfDbCalls);
+ assertEquals(10, PCRectString.PointToStringConverter.getNrOfConvertToDatastoreCalls() - nrOfDbCalls);
// convertToAttribute should not be called
- assertEquals(0, PCRect2.PointToStringConverter.getNrOfConvertToAttributeCalls() - nrOfAttrCalls);
+ assertEquals(0, PCRectString.PointToStringConverter.getNrOfConvertToAttributeCalls() - nrOfAttrCalls);
// Cleanup the 2nd-level cache and close the pm to make sure PCRect instances are not cached
- pm.getPersistenceManagerFactory().getDataStoreCache().evictAll(false, PCRect2.class);
+ pm.getPersistenceManagerFactory().getDataStoreCache().evictAll(false, PCRectString.class);
pm.close();
pm = null;
// Test: AttributeConverter method convertToAttribute is called when loading instance from the datastore
- nrOfDbCalls = PCRect2.PointToStringConverter.getNrOfConvertToDatastoreCalls();
- nrOfAttrCalls = PCRect2.PointToStringConverter.getNrOfConvertToAttributeCalls();
+ nrOfDbCalls = PCRectString.PointToStringConverter.getNrOfConvertToDatastoreCalls();
+ nrOfAttrCalls = PCRectString.PointToStringConverter.getNrOfConvertToAttributeCalls();
pm = getPM();
tx = pm.currentTransaction();
tx.begin();
- try (Query<PCRect2> q = pm.newQuery(PCRect2.class, "this.upperLeft == :point")) {
+ try (Query<PCRectString> q = pm.newQuery(PCRectString.class, "this.upperLeft == :point")) {
q.setParameters(new Point(UL_X+1, UL_Y+1));
- List<PCRect2> res = q.executeList();
+ List<PCRectString> res = q.executeList();
assertEquals(1, res.size());
- PCRect2 rect = res.get(0);
+ PCRectString rect = res.get(0);
Point ul = rect.getUpperLeft();
Point lr = rect.getLowerRight();
@@ -169,9 +169,9 @@ public class AttributeConverterTest extends JDO_Test {
}
// convertToDatastore should not be called to handle the query parameter
- assertTrue(PCRect2.PointToStringConverter.getNrOfConvertToDatastoreCalls() - nrOfDbCalls >= 1);
+ assertTrue(PCRectString.PointToStringConverter.getNrOfConvertToDatastoreCalls() - nrOfDbCalls >= 1);
// convertToAttribute should be called at least twice
- assertTrue(PCRect2.PointToStringConverter.getNrOfConvertToAttributeCalls() - nrOfAttrCalls >= 2);
+ assertTrue(PCRectString.PointToStringConverter.getNrOfConvertToAttributeCalls() - nrOfAttrCalls >= 2);
}
}
diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCRect2.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCRectString.java
similarity index 93%
rename from tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCRect2.java
rename to tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCRectString.java
index 772e30b..e016edb 100644
--- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCRect2.java
+++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCRectString.java
@@ -29,11 +29,11 @@ import java.util.Date;
*
* @author Michael Bouschen
*/
-public class PCRect2 {
+public class PCRectString {
private static long counter = new Date().getTime();
private static long newId() {
- synchronized (PCRect2.class) {
+ synchronized (PCRectString.class) {
return counter++;
}
}
@@ -43,15 +43,15 @@ public class PCRect2 {
private Point upperLeft;
private Point lowerRight;
- public PCRect2() {
+ public PCRectString() {
}
- public PCRect2(long id, Point ul, Point lr) {
+ public PCRectString(long id, Point ul, Point lr) {
upperLeft = ul;
lowerRight = lr;
}
- public PCRect2(Point ul, Point lr) {
+ public PCRectString(Point ul, Point lr) {
upperLeft = ul;
lowerRight = lr;
}
@@ -81,13 +81,13 @@ public class PCRect2 {
+ " ul: " + getUpperLeft().name()
+ " lr: " + getLowerRight().name();
} catch (NullPointerException ex) {
- rc = "NPE getting PCRect2's values";
+ rc = "NPE getting PCRectString's values";
}
return rc;
}
/**
- * PCRect2'S ObjectId class.
+ * PCRectString'S ObjectId class.
*/
public static class Oid implements Serializable {
public long id;
@@ -102,8 +102,8 @@ public class PCRect2 {
public int hashCode() { return (int)id ; }
public boolean equals(Object other) {
- if (other != null && (other instanceof PCRect2.Oid)) {
- PCRect2.Oid k = (PCRect2.Oid)other;
+ if (other != null && (other instanceof PCRectString.Oid)) {
+ PCRectString.Oid k = (PCRectString.Oid)other;
return k.id == this.id;
}
return false;
diff --git a/tck/src/main/resources/conf/jdori-log4j2.xml b/tck/src/main/resources/conf/jdori-log4j2.xml
index 52fc901..610d124 100644
--- a/tck/src/main/resources/conf/jdori-log4j2.xml
+++ b/tck/src/main/resources/conf/jdori-log4j2.xml
@@ -38,7 +38,7 @@
<!-- TCK Loggers -->
- <Logger name="org.apache.jdo.tck" level="debug" additivity="false">
+ <Logger name="org.apache.jdo.tck" level="info" additivity="false">
<AppenderRef ref="TCK"/>
</Logger>
<Logger name="org.springframework" level="error" additivity="false">
diff --git a/tck/src/main/resources/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/package.jdo b/tck/src/main/resources/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/package.jdo
index a421aee..f128097 100644
--- a/tck/src/main/resources/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/package.jdo
+++ b/tck/src/main/resources/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/package.jdo
@@ -52,11 +52,11 @@
</fetch-group>
</class>
- <class name="PCRect2"
- identity-type="application" objectid-class="org.apache.jdo.tck.pc.mylib.PCRect2$Oid">
+ <class name="PCRectString"
+ identity-type="application" objectid-class="org.apache.jdo.tck.pc.mylib.PCRectString$Oid">
<field name="id" primary-key="true"/>
- <field name="upperLeft" converter="org.apache.jdo.tck.pc.mylib.PCRect2$PointToStringConverter"/>
- <field name="lowerRight" converter="org.apache.jdo.tck.pc.mylib.PCRect2$PointToStringConverter"/>
+ <field name="upperLeft" converter="org.apache.jdo.tck.pc.mylib.PCRectString$PointToStringConverter"/>
+ <field name="lowerRight" converter="org.apache.jdo.tck.pc.mylib.PCRectString$PointToStringConverter"/>
</class>
<class name="PrimitiveTypes"
diff --git a/tck/src/main/resources/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/package.jdo b/tck/src/main/resources/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/package.jdo
index a9f7a4c..9ed2a93 100644
--- a/tck/src/main/resources/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/package.jdo
+++ b/tck/src/main/resources/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/package.jdo
@@ -43,9 +43,9 @@
</fetch-group>
</class>
- <class name="PCRect2" identity-type="datastore">
- <field name="upperLeft" converter="org.apache.jdo.tck.pc.mylib.PCRect2$PointToStringConverter"/>
- <field name="lowerRight" converter="org.apache.jdo.tck.pc.mylib.PCRect2$PointToStringConverter"/>
+ <class name="PCRectString" identity-type="datastore">
+ <field name="upperLeft" converter="org.apache.jdo.tck.pc.mylib.PCRectString$PointToStringConverter"/>
+ <field name="lowerRight" converter="org.apache.jdo.tck.pc.mylib.PCRectString$PointToStringConverter"/>
</class>
<class name="PrimitiveTypes" identity-type="datastore"/>
diff --git a/tck/src/main/resources/orm/applicationidentity/org/apache/jdo/tck/pc/mylib/package-standard.orm b/tck/src/main/resources/orm/applicationidentity/org/apache/jdo/tck/pc/mylib/package-standard.orm
index 92af565..0a7b45c 100644
--- a/tck/src/main/resources/orm/applicationidentity/org/apache/jdo/tck/pc/mylib/package-standard.orm
+++ b/tck/src/main/resources/orm/applicationidentity/org/apache/jdo/tck/pc/mylib/package-standard.orm
@@ -49,7 +49,7 @@
</field>
</class>
- <class name="PCRect2" table="PCRect2">
+ <class name="PCRectString" table="PCRectString">
<field name="id" column="ID"/>
<field name="lowerRight" column="LOWER_RIGHT"/>
<field name="upperLeft" column="UPPER_LEFT"/>
diff --git a/tck/src/main/resources/orm/datastoreidentity/org/apache/jdo/tck/pc/mylib/package-standard.orm b/tck/src/main/resources/orm/datastoreidentity/org/apache/jdo/tck/pc/mylib/package-standard.orm
index 61b4c1b..703cb21 100644
--- a/tck/src/main/resources/orm/datastoreidentity/org/apache/jdo/tck/pc/mylib/package-standard.orm
+++ b/tck/src/main/resources/orm/datastoreidentity/org/apache/jdo/tck/pc/mylib/package-standard.orm
@@ -53,7 +53,7 @@
</field>
</class>
- <class name="PCRect2" table="PCRect2">
+ <class name="PCRectString" table="PCRectString">
<datastore-identity strategy="identity" column="DATASTORE_IDENTITY"/>
<field name="id" column="ID"/>
<field name="lowerRight" column="LOWER_RIGHT"/>
diff --git a/tck/src/main/resources/sql/derby/applicationidentity/schema.sql b/tck/src/main/resources/sql/derby/applicationidentity/schema.sql
index 2394e81..b59914c 100644
--- a/tck/src/main/resources/sql/derby/applicationidentity/schema.sql
+++ b/tck/src/main/resources/sql/derby/applicationidentity/schema.sql
@@ -61,7 +61,7 @@ CREATE TABLE Item (
-------------------------
DROP TABLE PCRect;
-DROP TABLE PCRect2;
+DROP TABLE PCRectString;
DROP TABLE PCPoint;
DROP TABLE VersionedPCPoint;
DROP TABLE PCPoint2;
@@ -97,7 +97,7 @@ CREATE TABLE PCRect (
CONSTRAINT PCRCT_CONST PRIMARY KEY (ID)
);
-CREATE TABLE PCRect2 (
+CREATE TABLE PCRectString (
ID BIGINT NOT NULL,
UPPER_LEFT VARCHAR(30),
LOWER_RIGHT VARCHAR(30),
diff --git a/tck/src/main/resources/sql/derby/datastoreidentity/schema.sql b/tck/src/main/resources/sql/derby/datastoreidentity/schema.sql
index fb72459..985a126 100644
--- a/tck/src/main/resources/sql/derby/datastoreidentity/schema.sql
+++ b/tck/src/main/resources/sql/derby/datastoreidentity/schema.sql
@@ -41,7 +41,7 @@ CREATE TABLE address (
-------------------------
DROP TABLE PCRect;
-DROP TABLE PCRect2;
+DROP TABLE PCRectString;
DROP TABLE PCPoint;
DROP TABLE VersionedPCPoint;
DROP TABLE PCPoint2;
@@ -81,7 +81,7 @@ CREATE TABLE PCRect (
CONSTRAINT PCRCT_CONST PRIMARY KEY (DATASTORE_IDENTITY)
);
-CREATE TABLE PCRect2 (
+CREATE TABLE PCRectString (
DATASTORE_IDENTITY BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY,
ID BIGINT,
UPPER_LEFT VARCHAR(30),