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 2005/05/22 20:40:21 UTC
svn commit: r171355 [12/31] - in /incubator/jdo/trunk/fostore20: ./ src/
src/conf/ src/java/ src/java/org/ src/java/org/apache/
src/java/org/apache/jdo/ src/java/org/apache/jdo/impl/
src/java/org/apache/jdo/impl/fostore/ test/ test/conf/ test/fsuid2/
test/fsuid2/org/ test/fsuid2/org/apache/ test/fsuid2/org/apache/jdo/
test/fsuid2/org/apache/jdo/pc/ test/java/ test/java/org/
test/java/org/apache/ test/java/org/apache/jdo/
test/java/org/apache/jdo/impl/ test/java/org/apache/jdo/impl/fostore/
test/java/org/apache/jdo/pc/ test/java/org/apache/jdo/pc/appid/
test/java/org/apache/jdo/pc/empdept/
test/java/org/apache/jdo/pc/serializable/
test/java/org/apache/jdo/pc/xempdept/ test/java/org/apache/jdo/test/
test/java/org/apache/jdo/test/query/ test/java/org/apache/jdo/test/util/
test/jdo/ test/jdo/org/ test/jdo/org/apache/ test/jdo/org/apache/jdo/
test/jdo/org/apache/jdo/pc/ test/jdo/org/apache/jdo/pc/appid/
test/jdo/org/apache/jdo/pc/empdept/ test/jdo/org/apache/jdo/pc/serializable/
test/jdo/org/apache/jdo/pc/xempdept/
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/VerifyRequest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/VerifyRequest.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/VerifyRequest.java (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/VerifyRequest.java Sun May 22 11:40:13 2005
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.impl.fostore;
+
+import java.io.DataInput;
+import java.io.IOException;
+import java.util.BitSet;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.model.jdo.PersistenceModifier;
+import org.apache.jdo.state.StateManagerInternal;
+import org.apache.jdo.util.I18NHelper;
+
+
+/**
+ * Represents a request to verify that in-memory data is the same as that in
+ * the database.
+ *
+ * @author Dave Bristor
+ */
+//
+// This is client-side code. It does not need to live in the server.
+//
+
+//
+// XXX About VerifyRequest's current implementation
+// For now, VerifyRequest ignores the given array which indicates which
+// fields should be checked.
+//
+class VerifyRequest extends InsertRequest {
+ /** If true, verify values of object, otherwise verify only existence (and
+ * ignore remaining parameters). */
+ private final boolean verifyFields;
+
+ /** Fields to verify in database. */
+ private final BitSet fieldsToVerify;
+
+ /** Result of executing request. */
+ private boolean verified;
+
+ VerifyRequest(StateManagerInternal sm, Message m, FOStorePMF pmf,
+ boolean verifyFields, BitSet fieldsToVerify) {
+
+ super(sm, m, pmf);
+ this.verifyFields = verifyFields;
+ this.fieldsToVerify = fieldsToVerify;
+ }
+
+ //
+ // Methods from AbstractRequest
+ //
+
+ /**
+ * Provides the information necessary for a VerifyRequest.
+ * The format of this request is (aside from the request header):
+ * <pre>
+ * oid: OID
+ * boolean: verifyFields
+ * data block (optional; only if verifyFields is true)
+ * </pre>
+ * @see AbstractRequest#doRequestBody
+ */
+ protected void doRequestBody() throws IOException {
+ OID oid = (OID)sm.getInternalObjectId();
+ if (oid.isProvisional()) {
+ throw new FOStoreFatalInternalException(
+ this.getClass(), "doRequestBody", // NOI18N
+ msg.msg("ERR_OidIsProvisional", oid)); // NOI18N
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("VerifyRequest.dRB: begin, "+ oid + // NOI18N
+ ", verifyFields=" + verifyFields); // NOI18N
+ }
+
+ oid.write(out);
+ out.writeBoolean(verifyFields);
+
+ if (verifyFields) {
+ // XXX For now, verify the values of all the fields.
+ int fieldNumbers[] = jdoClass.getPersistentFieldNumbers();
+ writeBlock(fieldNumbers, true);
+ }
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("VerifyRequest.dRB: end"); // NOI18N
+ }
+ }
+
+ //
+ // Methods from Request
+ //
+
+ /**
+ * Handles reply data from a VerifyReply.
+ * The format of this reply is
+ * <pre>
+ * boolean: true => object exists in database, and (if verifyFields is
+ * true) values match those in request.
+ * </pre>
+ */
+ public void handleReply(Status status, DataInput in, int length)
+ throws IOException {
+
+ verified = in.readBoolean();
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("VerifyRequest.hR: " + getOID() + // NOI18N
+ ", verified=" + verified + ", status=" + status); // NOI18N
+ }
+ }
+
+ boolean getVerified() {
+ return verified;
+ }
+}
Added: incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/package.html
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/package.html?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/package.html (added)
+++ incubator/jdo/trunk/fostore20/src/java/org/apache/jdo/impl/fostore/package.html Sun May 22 11:40:13 2005
@@ -0,0 +1,84 @@
+<!--
+ 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.
+-->
+
+<html>
+<head>
+<title>Package javax.jdo</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body bgcolor="#FFFFFF">
+<p>This package contains the implementation of the File/Object Store JDO Reference
+ Implementation (FOStore, pronounced "foster"). </p>
+<p>This file provides information for implementors and maintainers of the package.</p>
+<h3>Identity in FOStore and provisional ID's</h3>
+<p>All objects created by the client have a datastore-provided ID, called an Object
+ Id (OID.java). Part of the OID represents the class of the object; these id's
+ are called Class Id's and are separately managed (CLID.java). When an object
+ is made persistent:</p>
+<blockquote>
+ <pre>Employee emp = new Employee("John Doe", 12345);</pre>
+ <pre>PersistenceManager pm = PersistenceManagerFactory.getPersistenceManager();</pre>
+ <pre>pm.makePersistent(emp);</pre>
+</blockquote>
+<p>the object is assigned a "provisional" OID, assigned by the client,
+ not by the datastore. When a real OID is required (getObjectId) or the transaction
+ commits, the user's object is then flushed to the store, and a real ID is provided.
+ The datastore provides a datastore ID corresponding to the provisional ID.</p>
+<p>The mapping from provisional to real id's is maintained by both the client
+ and the store. The client maintains it on a per-PMF basis (in FOStorePMF.java).
+ The store maintains it for all clients (currently a single map, which is incorrect
+ as it should be per-client; see FOStoreDatabase.java).</p>
+<p>Similar tables are kept, separately, for CLIDs. These tables are in FOStoreModel.java
+ on the client side, and in FOStoreDatabase.java on the store side. Recall that
+ the OID of an object contains the CLID of the class of the object. If no instances
+ of that class have yet been stored, then the OID contains a provisional CLID.
+ The process of storing the object also stores a representation of the object's
+ class, and creates a datastore-provided CLID.</p>
+<p>The need for each of the tables is as follows:</p>
+<p>OID, client: Assume a persistent object is created, and put into a persistent
+ graph structure. Assume further that the object is comitted, but not the graph
+ structure. At that point, the graph still refers to the object by its provisional
+ OID. Having this table allows us to find the real object ID.</p>
+<p>OID, store: Assume a graph structure of new objects is to be stored, in which
+ a single object is referenced more than once. Each time it is referenced, it
+ is with the provisional ID assigned by the client. The store must ensure that
+ an object is only assigned a single datastore ID, and this table ensures that.</p>
+<p>CLID, client: StoreManager implementations are required to be able to provide
+ a java.lang.Class given an OID. When assigning OIDs, FOStore will never use
+ a provisional CLID if the datastore-provided CLID is available. However, it
+ is possible that two objects of the same class are created, and one is stored.
+ The CLID table in FOStoreMetaData will, after the store, only the datastore-provided
+ ID. If one then asks the store manager for the class of the unstored object
+ by it's OID, we still have to provide the right answer. By keeping a mapping
+ of provisional IDs to datastore IDs in this table, we can do so.</p>
+<p>CLID, store: Exactly the same reasoning as for the OID table in the store:
+ ensuring that a given class is only ever assigned a single CLID. </p>
+<h3>Storing and Fetching Objects</h3>
+<p>Objects are stored in the database by way of InsertRequest, and fetched by
+way of FetchRequest. Each contains several methods to store and fetch Java
+types. If in the unlikely event that more primitive types are added to Java,
+they will have to be added here. Also, support will have to be added to
+FieldManager, which is outside of FOStore in the common package, and to it's
+implementation in the fostore package, in AbstractFieldManager</p>
+<p>More likely, however, is the need to extend the set of non-primitive types,
+ such as Collection types, that FOStore supports. Support for these lies in 2
+ files: CLID.java and the various <i>XXX</i>Transcriber.java files. The first
+ keeps a table of "known" CLID's, which maps between a java.lang.Class
+ and a compiletime-fixed CLID. The latter has a Transcriber class for each of
+ the known CLID's, for instance LocaleTranscriber writes and reads java.util.Locale
+ objects to/from I/O streams.</p>
+</body>
+</html>
Added: incubator/jdo/trunk/fostore20/test/conf/CF.properties.sav
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/conf/CF.properties.sav?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/conf/CF.properties.sav (added)
+++ incubator/jdo/trunk/fostore20/test/conf/CF.properties.sav Sun May 22 11:40:13 2005
@@ -0,0 +1,16 @@
+#
+# 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.
+
+org.apache.jdo.FOStoreConnectionFactory.option.UserName:quetzalcoatl
Added: incubator/jdo/trunk/fostore20/test/conf/JDO20Policy
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/conf/JDO20Policy?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/conf/JDO20Policy (added)
+++ incubator/jdo/trunk/fostore20/test/conf/JDO20Policy Sun May 22 11:40:13 2005
@@ -0,0 +1,173 @@
+// This is the policy file for JDO 2.0 assuming that
+// - the JDO API classes are in jar ${jdoapi},
+// - the btree implementation is in ${jdobtree},
+// - the JDO core classes are in ${jdocode},
+// - the JDO runtime classes are in ${jdoruntime},
+// - the JDO query classes are in ${jdoquery},
+// - the JDO fostore classes are in ${jdofostore},
+// - your test classes are in jar ${jdoritests},
+// - your application pc classes are in ${pcclasses},
+// - your database files are in ${testdir},
+// - junit is in ${junit},
+// - commons-logging is in ${logging},
+// - an XML parser implementation (if necessary) is in ${xmlparser}
+// - testlist is ${testlist}
+
+grant codeBase "file:${jdobtree}" {
+ // Allow btree classes to read the properties
+ // org.netbeans.mdr.persistence.*.
+ permission java.util.PropertyPermission "org.netbeans.mdr.persistence.*", "read";
+ permission java.util.PropertyPermission "perf.mdr.MDRCache", "read";
+ permission java.util.PropertyPermission "debug.mdr.MDRCache", "read";
+
+ // Allow btree classes to manage fostore database files.
+ permission java.io.FilePermission "${testdir}${/}*", "read,write,delete";
+ };
+
+grant codeBase "file:${jdocore}" {
+ // Allow jdori classes to read the jdo.dtd from jdo.jar.
+ permission java.io.FilePermission "${jdoapi}", "read";
+ // Allow jdori classes to read the JDO metadata files.
+ permission java.io.FilePermission "${pcclasses}", "read";
+
+ // Allow jdori classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+
+ // Allow jdori classes to access declared members of a class
+ // (e.g. a query accessing transient instances or non-managed fields).
+ // The query component needs access to persistent fields.
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+
+ // Allow the jdori classes to configure the JDK 1.4 logging
+ permission java.util.logging.LoggingPermission "control";
+ // Allow the jdori classes to read the JDK 1.4 logging properties file
+ permission java.io.FilePermission "${jdoritests}", "read";
+ };
+
+grant codeBase "file:${jdoruntime}" {
+ // Allow jdori classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdori classes to set the state manager for a
+ // persistence-capable class instance.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+ // Allow jdori classes to close the PersistenceManagerFactory
+ permission javax.jdo.spi.JDOPermission "closePersistenceManagerFactory";
+
+ // Allow the jdori classes to register a JVM shutdown hook.
+ permission java.lang.RuntimePermission "shutdownHooks";
+
+ // Allow the jdori classes to configure the JDK 1.4 logging
+ permission java.util.logging.LoggingPermission "control";
+ // Allow the jdori classes to read the JDK 1.4 logging properties file
+ permission java.io.FilePermission "${jdoritests}", "read";
+ };
+
+grant codeBase "file:${jdoquery}" {
+ // Allow jdori classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+
+ // Allow jdori classes to access declared members of a class
+ // (e.g. a query accessing transient instances or non-managed fields).
+ // The query component needs access to persistent fields.
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+ // Allow jdori classes to access transient instances or non-managed
+ // fields during a query.
+ permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+
+ // Allow the jdori classes to configure the JDK 1.4 logging
+ permission java.util.logging.LoggingPermission "control";
+ // Allow the jdori classes to read the JDK 1.4 logging properties file
+ permission java.io.FilePermission "${jdoritests}", "read";
+ };
+
+grant codeBase "file:${jdofostore}" {
+ // Allow jdori classes to read system properties including
+ // org.netbeans.modules.mdr.btreestorage.*
+ // user.home, status.verbose, maxInstances
+ permission java.util.PropertyPermission "*", "read";
+
+ // Allow jdori classes to read the directory where
+ // fostore database files are located.
+ permission java.io.FilePermission "${testdir}", "read";
+ // Allow jdori classes to manage fostore database files.
+ permission java.io.FilePermission "${testdir}${/}*", "read,write,delete";
+
+ // Allow jdori classes to specify a stream handler
+ // when constructing a fostore URL.
+ permission java.net.NetPermission "specifyStreamHandler";
+
+ // Allow jdori classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdori classes to close the PersistenceManagerFactory
+ permission javax.jdo.spi.JDOPermission "closePersistenceManagerFactory";
+
+ // Allow the jdori classes to register a JVM shutdown hook.
+ permission java.lang.RuntimePermission "shutdownHooks";
+
+ // Allow the jdori classes to configure the JDK 1.4 logging
+ permission java.util.logging.LoggingPermission "control";
+ // Allow the jdori classes to read the JDK 1.4 logging properties file
+ permission java.io.FilePermission "${jdoritests}", "read";
+ };
+
+grant codeBase "file:${jdoapi}" {
+ // Allow jdo classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow jdo classes to manage metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "manageMetadata";
+ // Allow jdo classes to set the state manager for a
+ // persistence-capable class instance.
+ permission javax.jdo.spi.JDOPermission "setStateManager";
+ };
+
+grant codeBase "file:${jdoritests}" {
+ // Allow the test classes to read system properties.
+ permission java.util.PropertyPermission "*", "read";
+ // Allow the test classes to read test lists.
+ permission java.io.FilePermission "${testlist}", "read";
+ // Allow the query test to write a log file.
+ permission java.io.FilePermission "${testdir}", "write";
+ // Allow test classes to close the PersistenceManagerFactory
+ permission javax.jdo.spi.JDOPermission "closePersistenceManagerFactory";
+ // Allow test classes to create a class loader
+ permission java.lang.RuntimePermission "createClassLoader";
+ // Allow test classes to get a class loader
+ permission java.lang.RuntimePermission "getClassLoader";
+ // Allow class loaders in test classes to read jar files
+ permission java.io.FilePermission "${pcclasses}", "read";
+ permission java.io.FilePermission "${fsuidjar}", "read";
+ permission java.io.FilePermission "${jdoapi}", "read";
+ // Allow test classes to manage fostore database files.
+ permission java.io.FilePermission "${testdir}${/}*", "read,write,delete";
+ // Allow test classes to get metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "getMetadata";
+ // Allow test classes to manage metadata for persistence-capable classes.
+ permission javax.jdo.spi.JDOPermission "manageMetadata";
+ // Allow test classes to access declared constructors via reflection
+ permission java.lang.RuntimePermission "accessDeclaredMembers";
+ // JUnit problem: accessing junit.properties is not privileged
+ permission java.io.FilePermission "${user.home}${/}junit.properties", "read";
+ // JUnit problem: accessing .junitsession is not privileged
+ permission java.io.FilePermission "${user.home}${/}.junitsession", "read,write";
+ // JUnit problem: accessing JUnit GUI icons is not privileged
+ permission java.io.FilePermission "${junit}", "read";
+ };
+
+grant codeBase "file:${junit}" {
+ // Allow junit classes to read system properties
+ permission java.util.PropertyPermission "*", "read";
+ // Allow junit classes to read the default file to specify junit properties.
+ permission java.io.FilePermission "${user.home}${/}junit.properties", "read";
+ // Allow junit classes to manage a file to specify the junit session.
+ permission java.io.FilePermission "${user.home}${/}.junitsession", "read,write";
+ };
+
+grant codeBase "file:${logging}" {
+ // Allow the apache commons logging classes to read logging properties files
+ permission java.io.FilePermission "${jdoritests}", "read";
+ };
+
+grant codeBase "file:${xmlparser}" {
+ // Allow the xmlparser classes to read system properties.
+ permission java.util.PropertyPermission "*", "read";
+ };
Added: incubator/jdo/trunk/fostore20/test/conf/PMF.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/conf/PMF.properties?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/conf/PMF.properties (added)
+++ incubator/jdo/trunk/fostore20/test/conf/PMF.properties Sun May 22 11:40:13 2005
@@ -0,0 +1,18 @@
+#
+# 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.
+
+javax.jdo.PersistenceManagerFactoryClass: org.apache.jdo.impl.fostore.FOStorePMF
+
+
Added: incubator/jdo/trunk/fostore20/test/conf/commons-logging.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/conf/commons-logging.properties?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/conf/commons-logging.properties (added)
+++ incubator/jdo/trunk/fostore20/test/conf/commons-logging.properties Sun May 22 11:40:13 2005
@@ -0,0 +1,47 @@
+#
+# 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.
+
+#
+# This is a sample apache commons logging configuration file defining logging
+# properties for the JDO2 Implementation (FOStore) sources and test cases.
+# It defines what logging implementation the apache commons logging API should
+# use by specifying the property org.apache.commons.logging.Log (see below).
+# Please note, that there are separate property files for each logging
+# implementation to set the log level of the loggers:
+# - SimpleLog: simplelog.properties
+# - JDK1.4 logging: logging.properties
+#
+# The JDO2 Implementation (FOStore) sources use the following logger instances:
+# org.apache.jdo.impl.fostore File Object Store implementation
+# Dependent projects:
+# org.apache.jdo.util Utility classes
+# org.apache.jdo.impl.model.jdo JDOModel implementation
+# org.apache.jdo.impl.model.jdo.xml XML parser for JDO metadata files
+# org.apache.jdo.impl.pm PM and PMF implementation
+# org.apache.jdo.impl.sco SCO implementation
+# org.apache.jdo.impl.state StateManager implementation
+# org.apache.jdo.store Generic StoreManager implementation
+# org.apache.jdo.impl.jdoql JDOQL query runtime
+# org.apache.jdo.impl.jdoql.jdoqlc JDOQL query compiler
+#
+# The test cases use the following logger instance:
+# org.apache.jdo.test
+#
+
+# Uncomment the next line if you want to use the apache simple logger
+#org.apache.commons.logging.Log = org.apache.commons.logging.impl.SimpleLog
+
+# Uncomment the next two lines if you want to use JDK 1.4 logging
+#org.apache.commons.logging.Log = org.apache.jdo.util.JDOJdk14Logger
Added: incubator/jdo/trunk/fostore20/test/conf/jndi.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/conf/jndi.properties?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/conf/jndi.properties (added)
+++ incubator/jdo/trunk/fostore20/test/conf/jndi.properties Sun May 22 11:40:13 2005
@@ -0,0 +1,17 @@
+#
+# 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.
+
+java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory
+java.naming.provider.url=file:.
Added: incubator/jdo/trunk/fostore20/test/conf/logging.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/conf/logging.properties?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/conf/logging.properties (added)
+++ incubator/jdo/trunk/fostore20/test/conf/logging.properties Sun May 22 11:40:13 2005
@@ -0,0 +1,74 @@
+#
+# 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.
+
+#
+# This is a sample properties file to configure standard JDK 1.4 logging for
+# the JDO2 Implementation (FOStore) sources and test cases.
+# Below you find an entry for each of the source and test logger instances.
+# Please uncomment the line and adapt the log level to your needs,
+# in case to want to enable a particular logger.
+#
+# The following describes the mapping between the log level of JDK 1.4 logging
+# and apache commns logging:
+# JDK 1.4 Apache
+# FINEST trace
+# FINE, FINER debug
+# INFO, CONFIG info
+# WARNING warn
+# SEVERE error, fatal
+#
+
+######################
+# JDORI test cases
+######################
+
+#org.apache.jdo.test.level = FINE
+
+######################
+# FOStore source logger
+######################
+
+# FOStore logger
+#org.apache.jdo.impl.fostore.level = FINE
+
+######################
+# Dependent projects
+######################
+
+# Utility class logger
+#org.apache.jdo.util.level = FINE
+# JDOModel logger
+#org.apache.jdo.impl.model.jdo.level = FINE
+# XML parser logger
+#org.apache.jdo.impl.model.jdo.xml.level = FINE
+# PM and PMF logger
+#org.apache.jdo.impl.pm.level = FINE
+# SCO logger
+#org.apache.jdo.impl.sco.level = FINE
+# StateManager logger
+#org.apache.jdo.impl.state.level = FINE
+# Generic StoreManager logger
+#org.apache.jdo.store.level = FINE
+# JDOQL query logger
+#org.apache.jdo.impl.jdoql.level = FINE
+# JDOQL query compiler logger
+#org.apache.jdo.impl.jdoql.jdoqlc.level = FINE
+
+######################
+# JDK 1.4 logging properties
+######################
+
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = FINEST
Added: incubator/jdo/trunk/fostore20/test/conf/simplelog.properties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/conf/simplelog.properties?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/conf/simplelog.properties (added)
+++ incubator/jdo/trunk/fostore20/test/conf/simplelog.properties Sun May 22 11:40:13 2005
@@ -0,0 +1,64 @@
+#
+# 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.
+
+#
+# This is a sample properties file to configure apache commons logging SimpleLog
+# implementation for the JDO2 Implementation (FOStore) sources and test cases.
+# Below you find an entry for each of the source and test logger instances.
+# Please uncomment the line and adapt the log level to your needs,
+# in case to want to enable a particular logger.
+#
+
+######################
+# JDORI test cases
+######################
+
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.test = debug
+
+######################
+# FOStore source logger
+######################
+
+# FOStore logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.fostore = debug
+
+######################
+# Dependent projects
+######################
+
+# Utility class logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.util = debug
+# JDOModel logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.model.jdo = debug
+# XML parser logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.model.jdo.xml = debug
+# PM and PMF logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.pm = debug
+# SCO logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.sco = debug
+# StateManager logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.state = debug
+# Generic StoreManager logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.store = debug
+# JDOQL query logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.jdoql = debug
+# JDOQL query compiler logger
+#org.apache.commons.logging.simplelog.log.org.apache.jdo.impl.jdoql.jdoqlc = debug
+
+######################
+# Default logging level
+######################
+
+org.apache.commons.logging.simplelog.defaultlog = error
Added: incubator/jdo/trunk/fostore20/test/conf/tests.list
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/conf/tests.list?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/conf/tests.list (added)
+++ incubator/jdo/trunk/fostore20/test/conf/tests.list Sun May 22 11:40:13 2005
@@ -0,0 +1,97 @@
+#
+# Note the following tests should not be added to the list,
+# because they need to be run separately
+# (see target test.all in build.xml):
+#
+# - org.apache.jdo.test.Test_FetchInserted:
+# needs an existing datastore, created by a run in a separate JVM
+# - JNDI test and JNDICF test:
+# needs an existing datastore, created by a run in a separate JVM
+# - org.apache.jdo.test.Test_GetObjectById2
+# - NonExistent
+# - EmpDeptAppIdExt:
+# starts the EmpDeptAppId tests insert, update, delete in separate JVMs
+# implemented by Test_EmpDeptAppIdInsert, Test_EmpDeptAppIdUpadte, and
+# Test_EmpDeptAppIdDelete
+# - Generator
+# - Enhancer
+
+#fostore/Test_Dumper Test_Rect
+
+org.apache.jdo.test.Test_JDOModel
+org.apache.jdo.impl.fostore.Test_Transcriber
+org.apache.jdo.impl.fostore.Test_FSUID
+org.apache.jdo.test.Test_ActivateClass
+org.apache.jdo.test.Test_Insert
+org.apache.jdo.test.Test_Many
+org.apache.jdo.test.Test_RollbackFlushedNew
+org.apache.jdo.test.Test_Fetch
+org.apache.jdo.test.Test_Fetch2
+org.apache.jdo.test.Test_Arrays
+org.apache.jdo.test.Test_RefArrays
+org.apache.jdo.test.Test_Interfaces
+org.apache.jdo.test.Test_Rect
+org.apache.jdo.test.Test_Primitives
+org.apache.jdo.test.Test_Stroke
+org.apache.jdo.test.Test_Cycle
+org.apache.jdo.test.Test_SCO
+org.apache.jdo.test.Test_Collections
+org.apache.jdo.test.Test_SCORollback
+org.apache.jdo.test.Test_SCOArrayList
+org.apache.jdo.test.Test_SCOArrayListOptimistic
+org.apache.jdo.test.Test_SCODate
+org.apache.jdo.test.Test_SCOHashMap
+org.apache.jdo.test.Test_SCOHashSet
+org.apache.jdo.test.Test_SCOHashtable
+org.apache.jdo.test.Test_SCOLinkedList
+org.apache.jdo.test.Test_SCOSqlDate
+org.apache.jdo.test.Test_SCOTreeMap
+org.apache.jdo.test.Test_SCOTreeSet
+org.apache.jdo.test.Test_SCOVector
+org.apache.jdo.test.Test_GetObjectById
+org.apache.jdo.test.Test_SerialPMs
+org.apache.jdo.test.Test_ParallelPMs
+org.apache.jdo.test.Test_Delete
+org.apache.jdo.test.Test_RectAppId
+org.apache.jdo.test.Test_EmpDeptAppId
+org.apache.jdo.test.Test_Extent
+org.apache.jdo.test.Test_EmpDeptSerialization
+org.apache.jdo.test.Test_HollowUpdate
+org.apache.jdo.test.Test_Reachability
+org.apache.jdo.test.Test_EmpDept
+org.apache.jdo.test.Test_Navigate
+org.apache.jdo.test.Test_LargeObj
+org.apache.jdo.test.Test_Update
+org.apache.jdo.test.Test_Rollback
+org.apache.jdo.test.Test_Serialize
+org.apache.jdo.test.Test_SerializeInher
+org.apache.jdo.test.Test_SerializeComplex
+org.apache.jdo.test.Test_NonTxAccess
+org.apache.jdo.test.Test_Insert2
+org.apache.jdo.test.Test_ObjectId
+org.apache.jdo.test.Test_Container
+org.apache.jdo.test.Test_Inheritance
+org.apache.jdo.test.Test_StringOID
+org.apache.jdo.test.Test_Optimistic
+org.apache.jdo.test.Test_FSUID2
+org.apache.jdo.test.Test_LifeCycle
+org.apache.jdo.test.Test_LifeCycle_RetF
+org.apache.jdo.test.Test_LifeCycle_Opt
+org.apache.jdo.test.Test_LifeCycle_RetFOpt
+org.apache.jdo.test.Test_NegAll
+org.apache.jdo.test.Test_PMFProperties
+org.apache.jdo.test.Test_Query
+org.apache.jdo.test.Test_4510817
+org.apache.jdo.test.Test_4515265
+org.apache.jdo.test.Test_WeakHashSet
+org.apache.jdo.test.Test_WeakValueHashMap
+org.apache.jdo.test.Test_AppId
+org.apache.jdo.test.Test_DupAppId
+org.apache.jdo.test.Test_PCDerived
+org.apache.jdo.test.Test_ClosePMF
+org.apache.jdo.test.Test_KeyFieldNull
+org.apache.jdo.test.Test_UserHashCode
+org.apache.jdo.test.Test_OptimisticNullNotNull
+org.apache.jdo.test.Test_Freezer
+org.apache.jdo.test.Test_ClassRegistration
+org.apache.jdo.test.Test_6214617
Added: incubator/jdo/trunk/fostore20/test/fsuid2/build.xml
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/fsuid2/build.xml?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/fsuid2/build.xml (added)
+++ incubator/jdo/trunk/fostore20/test/fsuid2/build.xml Sun May 22 11:40:13 2005
@@ -0,0 +1,85 @@
+<!--
+ 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.
+-->
+
+<project name="fsuid2" default="build" basedir=".">
+
+<property name="jdoapi" value="${user.home}/.maven/repository/apache-jdo/jars/jdo1-api-SNAPSHOT.jar"/>
+<property name="jdocore" value="${user.home}/.maven/repository/apache-jdo/jars/jdo2-core-20-SNAPSHOT.jar"/>
+<property name="jdoenhancer" value="${user.home}/.maven/repository/apache-jdo/jars/jdo2-enhancer-20-SNAPSHOT.jar"/>
+
+<property name="logging" value="${user.home}/.maven/repository/commons-logging/jars/commons-logging-1.0.4.jar"/>
+<property name="xmlparser" value=""/>
+<property name="fsuid2.jarfile" value="../fsuid2.jar"/>
+
+<property name="enhancer" value="org.apache.jdo.enhancer.Main"/>
+<property name="enhanceDir" value="enhance.out"/>
+
+<target name="build" depends="fsuid2.uptodate, fsuid2.jar"/>
+
+<target name="fsuid2.uptodate">
+ <uptodate property="fsuid2.enhancement.notRequired" targetfile="${fsuid2.jarfile}">
+ <srcfiles dir="org/apache/jdo/pc" includes="*.jdo, *.jdoproperties, PC*.java"/>
+ </uptodate>
+</target>
+
+<target name="fsuid2.jar" unless="fsuid2.enhancement.notRequired">
+ <javac srcdir="org/apache/jdo/pc" debug="on" includes="PCPoint.java" source="${maven.compile.source}" target="${maven.compile.target}"/>
+
+ <mkdir dir="${enhanceDir}"/>
+ <java fork="yes" failonerror="yes"
+ classname="${enhancer}"
+ classpath="${maven.build.dest};${jdoapi};${jdocore};${jdoenhancer};${xmlparser};${logging}">
+ <arg line="-f -d ${enhanceDir} -s . org/apache/jdo/pc/PCPoint.class"/>
+ </java>
+
+ <move todir="org/apache/jdo/pc">
+ <fileset dir="${enhanceDir}/org/apache/jdo/pc">
+ <include name="*.class"/>
+ </fileset>
+ </move>
+
+ <java fork="yes" failonerror="yes"
+ classname="org.apache.jdo.impl.enhancer.util.AugmentationTest"
+ classpath=".;${maven.build.dest};${jdoapi};${jdocore};${jdoenhancer}">
+ <arg line="-s"/>
+ <arg path=".;${jdoapi};${jdocore};${jdoenhancer}"/>
+ <arg line="--properties org/apache/jdo/pc/fsuid2.jdoproperties org.apache.jdo.pc.PCPoint"/>
+ </java>
+
+ <java fork="yes" failonerror="yes"
+ classname="org.apache.jdo.impl.enhancer.util.AnnotationTest"
+ classpath="${maven.build.dest};${jdocore};${jdoenhancer}">
+ <arg line="--properties org/apache/jdo/pc/fsuid2.jdoproperties org/apache/jdo/pc/PCPoint.class"/>
+ </java>
+
+ <delete file="${fsuid2.jarfile}"/>
+ <jar jarfile="${fsuid2.jarfile}">
+ <fileset dir="." includes="org/apache/jdo/pc/**/*.class,
+ org/apache/jdo/pc/**/*.jdo"/>
+ </jar>
+</target>
+
+<target name="clean">
+ <delete>
+ <fileset dir="." includes="**/*.class"/>
+ </delete>
+ <delete file="${fsuid2.jarfile}"/>
+ <delete dir="${enhanceDir}"/>
+</target>
+
+<target name="clobber" depends="clean"/>
+
+</project>
Added: incubator/jdo/trunk/fostore20/test/fsuid2/dist.xml
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/fsuid2/dist.xml?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/fsuid2/dist.xml (added)
+++ incubator/jdo/trunk/fostore20/test/fsuid2/dist.xml Sun May 22 11:40:13 2005
@@ -0,0 +1,66 @@
+<!--
+ 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.
+-->
+
+<project name="fsuid2" default="build" basedir=".">
+
+<property name="jdoapi" value="${user.home}/.maven/repository/apache-jdo/jars/jdo1-api-SNAPSHOT.jar"/>
+<property name="jdocore" value="${user.home}/.maven/repository/apache-jdo/jars/jdo2-core-20-SNAPSHOT.jar"/>
+<property name="jdoenhancer" value="${user.home}/.maven/repository/apache-jdo/jars/jdo2-enhancer-20-SNAPSHOT.jar"/>
+
+<property name="xmlparser" value=""/>
+<property name="fsuid2.jarfile" value="../fsuid2.jar"/>
+
+<property name="enhancer" value="org.apache.jdo.enhancer.Main"/>
+
+<target name="build" depends="fsuid2.uptodate, fsuid2.jar">
+</target>
+
+<target name="fsuid2.uptodate">
+ <uptodate property="fsuid2.enhancement.notRequired" targetfile="${fsuid2.jarfile}">
+ <srcfiles dir="." includes="*.jdoproperties, PC*.java"/>
+ </uptodate>
+</target>
+
+<target name="fsuid2.jar" unless="fsuid2enhancement.notRequired">
+ <javac srcdir="." debug="on" includes="PCPoint.java"/>
+
+ <mkdir dir="enhance.out"/>
+ <java fork="yes" failonerror="yes"
+ classname="${enhancer}"
+ classpath="${jdoapi};${jdoenhancer};${xmlparser}">
+ <arg line="-f -d enhance.out PCPoint.jdo PCPoint.class"/>
+ </java>
+
+ <move todir=".">
+ <fileset dir="enhance.out/test">
+ <include name="*.class"/>
+ </fileset>
+ </move>
+
+ <delete file="${fsuid2.jarfile}"/>
+ <jar jarfile="${fsuid2.jarfile}" basedir=".." includes="test/*.class, test/*.jdo"/>
+</target>
+
+<target name="clean">
+ <delete includeEmptyDirs="true">
+ <fileset dir="." includes="*.class, enhance.out"/>
+ </delete>
+ <delete file="${fsuid2.jarfile}"/>
+</target>
+
+<target name="clobber" depends="clean"/>
+
+</project>
Added: incubator/jdo/trunk/fostore20/test/fsuid2/org/apache/jdo/pc/PCPoint.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/fsuid2/org/apache/jdo/pc/PCPoint.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/fsuid2/org/apache/jdo/pc/PCPoint.java (added)
+++ incubator/jdo/trunk/fostore20/test/fsuid2/org/apache/jdo/pc/PCPoint.java Sun May 22 11:40:13 2005
@@ -0,0 +1,97 @@
+/*
+ * 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.pc;
+
+/**
+* A simple class with two fields
+*
+* @author Dave Bristor
+*/
+public class PCPoint {
+ public int x;
+ public Integer y;
+ float z;
+
+ public PCPoint() { }
+
+ public PCPoint(int x, int y, float z) {
+ this.x = x;
+ this.y = new Integer(y);
+ this.z = z;
+ }
+
+ public PCPoint(int x, Integer y, float z) {
+ this.x = x;
+ this.y = y;
+ this.z = z;
+ }
+
+ public String toString() {
+ String rc = null;
+ try {
+ rc = this.getClass().getName() + name();
+ } catch (NullPointerException ex) {
+ rc = "NPE getting PCPoint's values";
+ }
+ return rc;
+ }
+
+ public boolean equals(Object o) {
+ if ((o == null) || !(o instanceof PCPoint))
+ return false;
+ PCPoint other = (PCPoint)o;
+ if (x != other.x)
+ return false;
+ // Caution: comparing floats
+ if (z != other.z)
+ return false;
+ if (y == null)
+ return other.y == null;
+ else if (other.y == null)
+ return y == null;
+ else
+ return y.intValue() == other.y.intValue();
+ }
+
+ void setX(int x) {
+ this.x = x;
+ }
+
+ public int getX() {
+ return x;
+ }
+
+ void setY(Integer y) {
+ this.y = y;
+ }
+
+ public Integer getY() {
+ return y;
+ }
+
+ void setZ(float z) {
+ this.z = z;
+ }
+
+ float getZ() {
+ return z;
+ }
+
+ public String name() {
+ return " x: " + getX() + ", y: " + getY().intValue() + ", z: " + z;
+ }
+}
Added: incubator/jdo/trunk/fostore20/test/fsuid2/org/apache/jdo/pc/PCPoint.jdo
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/fsuid2/org/apache/jdo/pc/PCPoint.jdo?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/fsuid2/org/apache/jdo/pc/PCPoint.jdo (added)
+++ incubator/jdo/trunk/fostore20/test/fsuid2/org/apache/jdo/pc/PCPoint.jdo Sun May 22 11:40:13 2005
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jdo PUBLIC "-//Sun Microsystems, Inc.//DTD Java Data Objects Metadata 1.0//EN" "http://java.sun.com/dtd/jdo_1_0.dtd">
+<jdo>
+ <package name="org.apache.jdo.pc">
+
+ <!-- This will not be required once the JDOModel is fixed so that
+ the defaults defined in section 18.4 of the spec are working
+ -->
+ <class name="PCPoint"
+ identity-type="datastore">
+ <field name="x" persistence-modifier="persistent"/>
+ <field name="y" persistence-modifier="persistent"/>
+ <field name="z" persistence-modifier="persistent"/>
+ </class>
+
+ </package>
+</jdo>
+
Added: incubator/jdo/trunk/fostore20/test/fsuid2/org/apache/jdo/pc/fsuid2.jdoproperties
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/fsuid2/org/apache/jdo/pc/fsuid2.jdoproperties?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/fsuid2/org/apache/jdo/pc/fsuid2.jdoproperties (added)
+++ incubator/jdo/trunk/fostore20/test/fsuid2/org/apache/jdo/pc/fsuid2.jdoproperties Sun May 22 11:40:13 2005
@@ -0,0 +1,15 @@
+# Classnames can have the following attributes:
+# jdo:{persistent|transactional}
+# super: <classname>
+# oid: <classname>
+# access: {public|protected|package|private}
+# Fieldnames can have the following attributes:
+# type:<type>
+# access: {public|protected|package|private}
+# jdo:{persistent|transactional|transient}
+# annotation:{key|dfg|mediated}
+
+org.apache.jdo.pc.PCPoint=jdo:persistent
+org.apache.jdo.pc.PCPoint#x=jdo:persistent,annotation:mediated
+org.apache.jdo.pc.PCPoint#y=jdo:persistent,annotation:mediated
+org.apache.jdo.pc.PCPoint#z=jdo:persistent,annotation:mediated
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/impl/fostore/Test_FSUID.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/impl/fostore/Test_FSUID.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/impl/fostore/Test_FSUID.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/impl/fostore/Test_FSUID.java Sun May 22 11:40:13 2005
@@ -0,0 +1,103 @@
+/*
+ * 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.impl.fostore;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import javax.jdo.JDOUserException;
+
+import org.apache.jdo.test.util.AbstractTest;
+import org.apache.jdo.test.util.JDORITestRunner;
+
+/**
+* Test that FOStoreSchemaUID works as expected.
+*
+* @author Dave Bristor
+*/
+public class Test_FSUID extends AbstractTest {
+ /** */
+ private FOStorePMF pmf;
+
+ /** */
+ private FOStoreModel model;
+
+
+ /** */
+ public static void main(String args[]) {
+ JDORITestRunner.run(Test_FSUID.class);
+ }
+
+ /** Sets up the PMF for the test. */
+ protected void setUp() throws Exception
+ {
+ pmf = new FOStorePMF();
+ model = pmf.getModel();
+ }
+
+ /** */
+ protected void tearDown()
+ {
+ if (pmf != null) {
+ AccessController.doPrivileged(
+ new PrivilegedAction () {
+ public Object run () {
+ try {
+ pmf.close();
+ } catch (JDOUserException ex) {
+ System.out.println("pmf.close threw " + ex);
+ System.out.println("forcing close");
+ if( pmf instanceof FOStorePMF )
+ ((FOStorePMF)pmf).close(true);
+ }
+ return null;
+ }});
+ }
+ pmf = null;
+ model = null;
+ }
+
+ /**
+ * TestCase:
+ */
+ public void test() throws Exception
+ {
+ check("org.apache.jdo.pc.PCPoint",
+ "8956920886101650067");
+ check("org.apache.jdo.pc.PCRect",
+ "-8480732594287021208");
+ check("org.apache.jdo.pc.PCArrays",
+ "-8444984152061270200");
+ check("org.apache.jdo.pc.empdept.PCPerson",
+ "-6869885283474787185");
+ check("org.apache.jdo.pc.empdept.PCEmployee",
+ "-9214907875158685");
+ check("org.apache.jdo.pc.empdept.PCPartTimeEmployee",
+ "-7548523301931157884");
+ }
+
+ /** */
+ private void check(String className, String expected)
+ throws ClassNotFoundException
+ {
+ Class cls = Class.forName(className);
+ FOStoreSchemaUID fsuid = FOStoreSchemaUID.lookup(cls, model);
+ assertNotNull("FSUID for class " + className + " is null", fsuid);
+ assertEquals("Wrong FSUID", expected, fsuid.toString());
+ }
+
+}
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/impl/fostore/Test_Transcriber.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/impl/fostore/Test_Transcriber.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/impl/fostore/Test_Transcriber.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/impl/fostore/Test_Transcriber.java Sun May 22 11:40:13 2005
@@ -0,0 +1,279 @@
+/*
+ * 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.
+ */
+
+// Note the package: This way, we can access things the way we want the rest
+// of JDO to do so, and don't have to "publicize" any classes nor methods for
+// the sake of testing.
+//
+package org.apache.jdo.impl.fostore;
+
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import javax.jdo.JDOUserException;
+
+import org.apache.jdo.test.util.AbstractTest;
+import org.apache.jdo.test.util.JDORITestRunner;
+
+/**
+* This test is FOStore-specific; it tests only those transcribers. It does
+* not test for the ability to transcribe null values for objects; for that
+* see Test_Primitives which tests transcribing *and* storing of nulls. Also
+* see Test_Collections, which tests transcribing and storing of collections.
+*/
+public class Test_Transcriber extends AbstractTest {
+ //
+ // Transcribe these
+ // For now, don't transcribe object (we don't do objects yet), just
+ // transcribe their fields.
+ //
+ static boolean primitiveBoolean = true;
+ static char primitiveChar = 'z';
+ static byte primitiveByte = 0xf;
+ static short primitiveShort = 12;
+ static int primitiveInt = 42;
+ static long primitiveLong = Long.MAX_VALUE;
+ static float primitiveFloat = 123.45f;
+ static double primitiveDouble = 3.14159;
+ static String primitiveObject = "hello, world";
+
+ private FOStorePMF pmf;
+
+ /** */
+ public static void main(String args[]) {
+ JDORITestRunner.run(Test_Transcriber.class);
+ }
+
+ /** Sets up the PMF for the test. */
+ protected void setUp() throws Exception
+ {
+ pmf = new FOStorePMF();
+ }
+
+ /** */
+ protected void tearDown()
+ {
+ if (pmf != null) {
+ AccessController.doPrivileged(
+ new PrivilegedAction () {
+ public Object run () {
+ try {
+ pmf.close();
+ } catch (JDOUserException ex) {
+ System.out.println("pmf.close threw " + ex);
+ System.out.println("forcing close");
+ if( pmf instanceof FOStorePMF )
+ ((FOStorePMF)pmf).close(true);
+ }
+ return null;
+ }});
+ }
+ pmf = null;
+ }
+
+ // The idea is that we're going to write a bunch of stuff to a data
+ // output stream, then read it back in; we should get the same data
+ // back.
+ public void test() throws Exception {
+ // Step 1: store
+ //
+ FOStoreOutput fos = new FOStoreOutput();
+ storePrimitives(fos);
+
+ // Step 2: fetch
+ //
+ byte data[] = fos.getBuf();
+ FOStoreInput fis = new FOStoreInput(data, 0, data.length);
+ fetchPrimitives(fis);
+ }
+
+ void storePrimitives(FOStoreOutput fos) throws Exception {
+ FOStoreTranscriberFactory tf = FOStoreTranscriberFactory.getInstance();
+ FOStoreTranscriber t = null;
+
+ try {
+ t = (FOStoreTranscriber)tf.getTranscriber(boolean.class)[0];
+ t.storeBoolean(primitiveBoolean, fos);
+ assertEquals("Stored primitiveBoolean transcriber",
+ "org.apache.jdo.impl.fostore.BooleanTranscriber",
+ t.getClass().getName());
+
+ t = (FOStoreTranscriber)tf.getTranscriber(char.class)[0];
+ t.storeChar(primitiveChar, fos);
+ assertEquals("Stored primitiveChar transcriber",
+ "org.apache.jdo.impl.fostore.CharTranscriber",
+ t.getClass().getName());
+
+ t = (FOStoreTranscriber)tf.getTranscriber(byte.class)[0];
+ t.storeByte(primitiveByte, fos);
+ assertEquals("Stored primitiveByte transcriber ",
+ "org.apache.jdo.impl.fostore.ByteTranscriber",
+ t.getClass().getName());
+
+ t = (FOStoreTranscriber)tf.getTranscriber(short.class)[0];
+ t.storeShort(primitiveShort, fos);
+ assertEquals("Stored primitiveShort transcriber ",
+ "org.apache.jdo.impl.fostore.ShortTranscriber",
+ t.getClass().getName());
+
+ t = (FOStoreTranscriber)tf.getTranscriber(int.class)[0];
+ t.storeInt(primitiveInt, fos);
+ assertEquals("Stored primitiveInt transcriber ",
+ "org.apache.jdo.impl.fostore.IntTranscriber",
+ t.getClass().getName());
+
+ t = (FOStoreTranscriber)tf.getTranscriber(long.class)[0];
+ t.storeLong(primitiveLong, fos);
+ assertEquals("Stored primitiveLong transcriber ",
+ "org.apache.jdo.impl.fostore.LongTranscriber",
+ t.getClass().getName());
+
+ t = (FOStoreTranscriber)tf.getTranscriber(float.class)[0];
+ t.storeFloat(primitiveFloat, fos);
+ assertEquals("Stored primitiveFloat transcriber ",
+ "org.apache.jdo.impl.fostore.FloatTranscriber",
+ t.getClass().getName());
+
+ t = (FOStoreTranscriber)tf.getTranscriber(double.class)[0];
+ t.storeDouble(primitiveDouble, fos);
+ assertEquals("Stored primitiveDouble transcriber ",
+ "org.apache.jdo.impl.fostore.DoubleTranscriber",
+ t.getClass().getName());
+
+ t = (FOStoreTranscriber)tf.getTranscriber(primitiveObject.getClass())[0];
+ t.storeObject(primitiveObject, fos);
+ assertEquals("Stored primitiveObject transcriber ",
+ "org.apache.jdo.impl.fostore.ObjectTranscriber",
+ t.getClass().getName());
+ } catch (IOException ex) {
+ throw new Exception("Couldn't store a primitive: " + ex);
+ }
+ }
+
+ void fetchPrimitives(FOStoreInput fis) throws Exception {
+ FOStoreTranscriberFactory tf = FOStoreTranscriberFactory.getInstance();
+ FOStoreTranscriber t;
+ boolean aBoolean;
+ char aChar;
+ byte aByte;
+ short aShort;
+ int anInt;
+ long aLong;
+ float aFloat;
+ double aDouble;
+ Object anObject;
+
+ try {
+ t = (BooleanTranscriber)tf.getTranscriber(boolean.class)[0];
+ aBoolean = t.fetchBoolean(fis);
+ } catch (IOException ex) {
+ throw new Exception("Couldn't fetch primitiveBoolean: " + ex);
+ }
+ assertEquals("Wrong value retrieving primitiveBoolean", primitiveBoolean, aBoolean);
+ assertEquals("Fetched primitiveBoolean transcriber",
+ "org.apache.jdo.impl.fostore.BooleanTranscriber",
+ t.getClass().getName());
+
+ try {
+ t = (CharTranscriber)tf.getTranscriber(char.class)[0];
+ aChar = t.fetchChar(fis);
+ } catch (IOException ex) {
+ throw new Exception("Couldn't fetch primitiveChar: " + ex);
+ }
+ assertEquals("Wrong value retrieving primitiveChar", primitiveChar, aChar);
+ assertEquals("Fetched primitiveChar transcriber",
+ "org.apache.jdo.impl.fostore.CharTranscriber",
+ t.getClass().getName());
+ try {
+ t = (ByteTranscriber)tf.getTranscriber(byte.class)[0];
+ aByte = t.fetchByte(fis);
+ } catch (IOException ex) {
+ throw new Exception("Couldn't fetch primitiveByte: " + ex);
+ }
+ assertEquals("Wrong value retrieving primitiveByte", primitiveByte, aByte);
+ assertEquals("Fetched primitiveByte transcriber",
+ "org.apache.jdo.impl.fostore.ByteTranscriber",
+ t.getClass().getName());
+
+ try {
+ t = (ShortTranscriber)tf.getTranscriber(short.class)[0];
+ aShort = t.fetchShort(fis);
+ } catch (IOException ex) {
+ throw new Exception("Couldn't fetch primitiveShort: " + ex);
+ }
+ assertEquals("Wrong value retrieving primitiveShort", primitiveShort, aShort);
+ assertEquals("Fetched primitiveShort transcriber",
+ "org.apache.jdo.impl.fostore.ShortTranscriber",
+ t.getClass().getName());
+
+ try {
+ t = (IntTranscriber)tf.getTranscriber(int.class)[0];
+ anInt = t.fetchInt(fis);
+ } catch (IOException ex) {
+ throw new Exception("Couldn't fetch primitiveInt: " + ex);
+ }
+ assertEquals("Wrong value retrieving primitiveInt", primitiveInt, anInt);
+ assertEquals("Fetched primitiveInt transcriber",
+ "org.apache.jdo.impl.fostore.IntTranscriber",
+ t.getClass().getName());
+
+ try {
+ t = (LongTranscriber)tf.getTranscriber(long.class)[0];
+ aLong = t.fetchLong(fis);
+ } catch (IOException ex) {
+ throw new Exception("Couldn't fetch primitiveLong: " + ex);
+ }
+ assertEquals("Wrong value retrieving primitiveLong", primitiveLong, aLong);
+ assertEquals("Fetched primitiveLong transcribers",
+ "org.apache.jdo.impl.fostore.LongTranscriber",
+ t.getClass().getName());
+
+ try {
+ t = (FloatTranscriber)tf.getTranscriber(float.class)[0];
+ aFloat = t.fetchFloat(fis);
+ } catch (IOException ex) {
+ throw new Exception("Couldn't fetch primitiveFloat: " + ex);
+ }
+ assertEquals("Wrong value retrieving primitiveFloat", primitiveFloat, aFloat, 1e-2f);
+ assertEquals("Fetched primitiveFloat transcriber",
+ "org.apache.jdo.impl.fostore.FloatTranscriber",
+ t.getClass().getName());
+
+ try {
+ t = (DoubleTranscriber)tf.getTranscriber(double.class)[0];
+ aDouble = t.fetchDouble(fis);
+ } catch (IOException ex) {
+ throw new Exception("Couldn't fetch primitiveDouble: " + ex);
+ }
+ assertEquals("Wrong value retrieving primitiveDouble", primitiveDouble, aDouble, 1e-4);
+ assertEquals("Fetched primitiveDouble transcriber",
+ "org.apache.jdo.impl.fostore.DoubleTranscriber",
+ t.getClass().getName());
+
+ try {
+ t = (ObjectTranscriber)tf.getTranscriber(Object.class)[0];
+ anObject = t.fetchObject(fis, null, -1);
+ } catch (IOException ex) {
+ throw new Exception("Couldn't fetch primitiveObject: " + ex);
+ }
+
+ assertEquals("Wrong value retrieving primitiveObject", primitiveObject, anObject);
+ assertEquals("Fetched primitiveObject transcriber",
+ "org.apache.jdo.impl.fostore.ObjectTranscriber",
+ t.getClass().getName());
+ }
+}
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/DepartmentFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/DepartmentFactory.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/DepartmentFactory.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/DepartmentFactory.java Sun May 22 11:40:13 2005
@@ -0,0 +1,46 @@
+/*
+ * 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.pc;
+
+import org.apache.jdo.test.util.Factory;
+
+/**
+* Provides a means to create objects that are inserted into a database, and
+* for verifying that they've been retrieved OK.
+*
+* @author Dave Bristor
+*/
+public class DepartmentFactory implements Factory {
+ /**
+ * Returns the class instance of the pc class of this factory.
+ */
+ public Class getPCClass()
+ {
+ return PCDepartment.class;
+ }
+
+ public Object create(int index) {
+ return null; // Not needed for current tests.
+ }
+
+ // Not needed by this implementation.
+ public void setVerify(int x) { }
+
+ public boolean verify(int i, Object pc) {
+ return true;
+ }
+}
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/EmployeeFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/EmployeeFactory.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/EmployeeFactory.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/EmployeeFactory.java Sun May 22 11:40:13 2005
@@ -0,0 +1,46 @@
+/*
+ * 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.pc;
+
+import org.apache.jdo.test.util.Factory;
+
+/**
+* Provides a means to create objects that are inserted into a database, and
+* for verifying that they've been retrieved OK.
+*
+* @author Dave Bristor
+*/
+public class EmployeeFactory implements Factory {
+ /**
+ * Returns the class instance of the pc class of this factory.
+ */
+ public Class getPCClass()
+ {
+ return PCEmployee.class;
+ }
+
+ public Object create(int index) {
+ return null; // Not needed for current tests.
+ }
+
+ // Not needed by this implementation.
+ public void setVerify(int x) { }
+
+ public boolean verify(int i, Object pc) {
+ return true;
+ }
+}
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/InsuranceFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/InsuranceFactory.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/InsuranceFactory.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/InsuranceFactory.java Sun May 22 11:40:13 2005
@@ -0,0 +1,46 @@
+/*
+ * 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.pc;
+
+import org.apache.jdo.test.util.Factory;
+
+/**
+* Provides a means to create objects that are inserted into a database, and
+* for verifying that they've been retrieved OK.
+*
+* @author Dave Bristor
+*/
+public class InsuranceFactory implements Factory {
+ /**
+ * Returns the class instance of the pc class of this factory.
+ */
+ public Class getPCClass()
+ {
+ return PCInsurance.class;
+ }
+
+ public Object create(int index) {
+ return null; // Not needed for current tests.
+ }
+
+ // Not needed by this implementation.
+ public void setVerify(int x) { }
+
+ public boolean verify(int i, Object pc) {
+ return true;
+ }
+}
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/InterfacesFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/InterfacesFactory.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/InterfacesFactory.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/InterfacesFactory.java Sun May 22 11:40:13 2005
@@ -0,0 +1,50 @@
+/*
+ * 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.pc;
+
+import org.apache.jdo.test.util.Factory;
+
+
+/**
+* Provides a means to create objects that are inserted into a database, and
+* for verifying that they've been retrieved OK.
+*
+* @author Dave Bristor
+*/
+public class InterfacesFactory implements Factory {
+ /**
+ * Returns the class instance of the pc class of this factory.
+ */
+ public Class getPCClass()
+ {
+ return PCInterfaces.class;
+ }
+
+ public Object create(int index) {
+ PCInterfaces rc = new PCInterfaces();
+ rc.init();
+ return rc;
+ }
+
+ // Not needed by this implementation.
+ public void setVerify(int x) { }
+
+ // Not needed by this implementation.
+ public boolean verify(int i, Object pc) {
+ return true;
+ }
+}
Added: incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/LargeObjFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/LargeObjFactory.java?rev=171355&view=auto
==============================================================================
--- incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/LargeObjFactory.java (added)
+++ incubator/jdo/trunk/fostore20/test/java/org/apache/jdo/pc/LargeObjFactory.java Sun May 22 11:40:13 2005
@@ -0,0 +1,59 @@
+/*
+ * 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.pc;
+
+import org.apache.jdo.test.util.Factory;
+
+
+/**
+* Provides a means to create objects that are inserted into a database, and
+* for verifying that they've been retrieved OK.
+*
+* @author Dave Bristor
+*/
+public class LargeObjFactory implements Factory {
+ private int size;
+
+ public LargeObjFactory() { }
+
+ public LargeObjFactory(int size) {
+ this.size = size;
+ }
+
+ /**
+ * Returns the class instance of the pc class of this factory.
+ */
+ public Class getPCClass()
+ {
+ return PCLargeObj.class;
+ }
+
+ public Object create(int index) {
+ PCLargeObj rc = new PCLargeObj();
+ rc.init(size);
+ return rc;
+ }
+
+ public void setVerify(int verify) {
+ size = verify;
+ }
+
+ public boolean verify(int i, Object pc) {
+ PCLargeObj o = (PCLargeObj)pc;
+ return o.verify(false);
+ }
+}