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/05/31 18:30:01 UTC

svn commit: r179235 - in /incubator/jdo/trunk/tck20/test: java/org/apache/jdo/tck/enhancement/ orm/applicationidentity/org/apache/jdo/tck/pc/company/ orm/datastoreidentity/org/apache/jdo/tck/pc/company/ sql/derby/

Author: mcaisse
Date: Tue May 31 09:30:00 2005
New Revision: 179235

URL: http://svn.apache.org/viewcvs?rev=179235&view=rev
Log:
JDO-1 Forgot to rm/add; minor fixes to metadata

Added:
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/FieldAccessModified.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/ImplementsPersistenceCapable.java
Removed:
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/FieldAccessModified.java.fix
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/ImplementsPersistenceCapable.java.fix
Modified:
    incubator/jdo/trunk/tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-derby.orm
    incubator/jdo/trunk/tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-derby.orm
    incubator/jdo/trunk/tck20/test/sql/derby/schema1.sql
    incubator/jdo/trunk/tck20/test/sql/derby/schema2.sql

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/FieldAccessModified.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/FieldAccessModified.java?rev=179235&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/FieldAccessModified.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/FieldAccessModified.java Tue May 31 09:30:00 2005
@@ -0,0 +1,106 @@
+/*
+ * 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.enhancement;
+
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.jdo.impl.enhancer.util.AnnotationTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> FieldAccessModified
+ *<BR>
+ *<B>Keywords:</B> enhancement
+ *<BR>
+ *<B>Assertion ID:</B> .
+ *<BR>
+ *<B>Assertion Description: </B>
+The enhancer modifies field accesses to guarantee that the values of fields
+are retrieved from the data store prior to application usage.
+<OL TYPE="A">
+<LI>For any field access that reads the value of a field, the getfield byte code
+is replaced with a call to a generated local method, <code>jdoGetXXX</code></LI>
+<LI>For any field access that stores the new value of a field, the putfield
+byte code is replaced with a call to a generated local method,
+<code>jdoSetXXX</code></LI>
+</OL>
+
+ */
+
+public class FieldAccessModified extends EnhancerTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion (FieldAccessModified) 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(FieldAccessModified.class);
+    }
+
+    
+    /** */
+    public void test() {
+        if (debug)
+            logger.debug("org.apache.jdo.tck.enhancement.FieldAccessModified.run");
+        PMFPropertiesObject = loadProperties(PMFProperties); // will exit here if no properties
+        runTestAllPackages();
+    }
+
+    /** */
+    protected void runTestOnePackage (String packageName, List classNames) {
+        if (debug)
+            logger.debug("FieldAccessModified.testOnePackage: " + 
+                         packageName + " classes " + classNames);
+        
+        PrintWriter out = new PrintWriter(System.out);
+        final AnnotationTest test = new AnnotationTest(out, out);
+        final String classpath = System.getProperty("java.class.path");
+        final String jdoPropertiesFileName = 
+            packageName.replace ('.', '/') + "/jdoTest.properties"; //NOI18N        
+        final String[] args = new String[classNames.size() + 6];
+        int index = 0;
+        // init arguments for AnnotationTest.run call
+        // specify properties file
+        args[index++] = "--properties";
+        args[index++] = jdoPropertiesFileName;
+        // specify jdo path to find the properties file
+        args[index++] = "-j";
+        args[index++] = classpath;
+        // specify source path to find the classes
+        args[index++] = "-s";
+        args[index++] = classpath;
+        // add class names
+        for (java.util.Iterator i = classNames.iterator(); i.hasNext();) {
+            args[index++] = (String)i.next();
+        }
+        if (debug)
+            logger.debug ("Run AnnotationTest with args " + Arrays.asList(args));
+        int errors = test.run(args);
+        if (errors > 0) {
+            fail(ASSERTION_FAILED,
+                 "AnnotationTest with args " + Arrays.asList(args) +
+                 " results in " + errors + " errors.");
+        }
+    }
+}

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/ImplementsPersistenceCapable.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/ImplementsPersistenceCapable.java?rev=179235&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/ImplementsPersistenceCapable.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/ImplementsPersistenceCapable.java Tue May 31 09:30:00 2005
@@ -0,0 +1,99 @@
+/*
+ * 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.enhancement;
+
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.jdo.impl.enhancer.util.AugmentationTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Implements PersistenceCapable Added
+ *<BR>
+ *<B>Keywords:</B> enhancement
+ *<BR>
+ *<B>Assertion ID:</B> A20.3-0.
+ *<BR>
+ *<B>Assertion Description: </B>
+The Reference Enhancer makes the following change
+to persistence-capable classes:
+it adds <code>&quot;implements javax.jdo.PersistenceCapable</code>&quot;
+to the class definition.
+
+ */
+
+public class ImplementsPersistenceCapable extends EnhancerTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A20.3-0 (ImplementsPersistenceCapable) 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(ImplementsPersistenceCapable.class);
+    }
+
+    /** */
+    public void test() {
+        if (debug)
+            logger.debug("org.apache.jdo.tck.enhancement.ImplementsPersistenceCapable.run");
+        runTestAllPackages();
+    }
+
+    /** */
+    protected void runTestOnePackage (String packageName, List classNames) {
+        if (debug) 
+            logger.debug("ImplementsPersistenceCapable.testOnePackage: " + 
+                         packageName + " classes " + classNames);
+        
+        PrintWriter out = new PrintWriter(System.out);
+        final AugmentationTest test = new AugmentationTest(out, out);
+        final String classpath = System.getProperty("java.class.path");
+        final String jdoPropertiesFileName = 
+            packageName.replace ('.', '/') + "/jdoTest.properties"; //NOI18N        
+        final String[] args = new String[classNames.size() + 6];
+        int index = 0;
+        // init arguments for AugmentationTest.run call
+        // specify properties file
+        args[index++] = "--properties";
+        args[index++] = jdoPropertiesFileName;
+        // specify jdo path to find the properties file
+        args[index++] = "-j";
+        args[index++] = classpath;
+        // specify source path to find the classes
+        args[index++] = "-s";
+        args[index++] = classpath;
+        // add class names
+        for (java.util.Iterator i = classNames.iterator(); i.hasNext();) {
+            args[index++] = (String)i.next();
+        }
+        if (debug)
+            logger.debug ("Run AugmentationTest with args " + Arrays.asList(args));
+        int errors = test.run(args);
+        if (errors > 0) {
+            fail(ASSERTION_FAILED,
+                 "AugmentationTest with args " + Arrays.asList(args) +
+                 " results in " + errors + " errors.");
+        }
+    }
+}

Modified: incubator/jdo/trunk/tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-derby.orm
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-derby.orm?rev=179235&r1=179234&r2=179235&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-derby.orm (original)
+++ incubator/jdo/trunk/tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/company/package-derby.orm Tue May 31 09:30:00 2005
@@ -126,7 +126,9 @@
         <class name="Project" table="projects">
             <field name="projid" column="PROJID" primary-key="true"/>
             <field name="name" column="NAME"/>
-            <field name="budget" column="BUDGET"/>
+            <field name="budget">
+               <column name="BUDGET" jdbc-type="DECIMAL" length="11" scale="2"/>
+            </field>
             <field name="reviewers" table="project_reviewer">
                 <join column="PROJID"/>
                 <element column="REVIEWER"/>

Modified: incubator/jdo/trunk/tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-derby.orm
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-derby.orm?rev=179235&r1=179234&r2=179235&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-derby.orm (original)
+++ incubator/jdo/trunk/tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/company/package-derby.orm Tue May 31 09:30:00 2005
@@ -126,7 +126,9 @@
         <class name="Project" table="projects">
             <datastore-identity strategy="identity" column="PROJID"/>
             <field name="name" column="NAME"/>
-            <field name="budget" column="BUDGET"/>
+            <field name="budget">
+               <column name="BUDGET" jdbc-type="DECIMAL" length="11" scale="2"/>
+            </field>
             <field name="reviewers" table="project_reviewer">
                 <join column="PROJID"/>
                 <element column="REVIEWER"/>

Modified: incubator/jdo/trunk/tck20/test/sql/derby/schema1.sql
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/sql/derby/schema1.sql?rev=179235&r1=179234&r2=179235&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/sql/derby/schema1.sql (original)
+++ incubator/jdo/trunk/tck20/test/sql/derby/schema1.sql Tue May 31 09:30:00 2005
@@ -129,7 +129,7 @@
 CREATE TABLE projects (
     PROJID INTEGER NOT NULL,
     NAME VARCHAR(32) NOT NULL,
-    BUDGET DECIMAL NOT NULL,
+    BUDGET DECIMAL(11,2) NOT NULL,
     CONSTRAINT PROJS_PK PRIMARY KEY (PROJID)
 );
 

Modified: incubator/jdo/trunk/tck20/test/sql/derby/schema2.sql
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/sql/derby/schema2.sql?rev=179235&r1=179234&r2=179235&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/sql/derby/schema2.sql (original)
+++ incubator/jdo/trunk/tck20/test/sql/derby/schema2.sql Tue May 31 09:30:00 2005
@@ -129,7 +129,7 @@
 CREATE TABLE projects (
     PROJID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY,
     NAME VARCHAR(32) NOT NULL,
-    BUDGET DECIMAL NOT NULL,
+    BUDGET DECIMAL(11,2) NOT NULL,
     CONSTRAINT PROJS_PK PRIMARY KEY (PROJID)
 );