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/04/04 21:43:47 UTC
svn commit: r160090 [12/63] - in incubator/jdo/trunk: ./ tck20/
tck20/assertions/ tck20/iut_jars/ tck20/test/ tck20/test/conf/
tck20/test/java/ tck20/test/java/org/ tck20/test/java/org/apache/
tck20/test/java/org/apache/jdo/ tck20/test/java/org/apache/jdo/tck/
tck20/test/java/org/apache/jdo/tck/api/
tck20/test/java/org/apache/jdo/tck/api/instancecallbacks/
tck20/test/java/org/apache/jdo/tck/api/jdohelper/
tck20/test/java/org/apache/jdo/tck/api/persistencemanager/
tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/
tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/
tck20/test/java/org/apache/jdo/tck/api/persistencemanager/extent/
tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/
tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/
tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/
tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/
tck20/test/java/org/apache/jdo/tck/enhancement/
tck20/test/java/org/apache/jdo/tck/extents/
tck20/test/java/org/apache/jdo/tck/lifecycle/
tck20/test/java/org/apache/jdo/tck/lifecycle/nontransactional/
tck20/test/java/org/apache/jdo/tck/models/
tck20/test/java/org/apache/jdo/tck/models/embedded/
tck20/test/java/org/apache/jdo/tck/models/fieldtypes/
tck20/test/java/org/apache/jdo/tck/models/inheritance/
tck20/test/java/org/apache/jdo/tck/pc/
tck20/test/java/org/apache/jdo/tck/pc/company/
tck20/test/java/org/apache/jdo/tck/pc/fieldtypes/
tck20/test/java/org/apache/jdo/tck/pc/inheritance/
tck20/test/java/org/apache/jdo/tck/pc/instancecallbacks/
tck20/test/java/org/apache/jdo/tck/pc/lifecycle/
tck20/test/java/org/apache/jdo/tck/pc/mylib/
tck20/test/java/org/apache/jdo/tck/query/
tck20/test/java/org/apache/jdo/tck/query/operators/
tck20/test/java/org/apache/jdo/tck/transactions/
tck20/test/java/org/apache/jdo/tck/util/ tck20/test/jdo/
tck20/test/jdo/applicationidentity/ tck20/test/jdo/applicationidentity/org/
tck20/test/jdo/applicationidentity/org/apache/
tck20/test/jdo/applicationidentity/org/apache/jdo/
tck20/test/jdo/applicationidentity/org/apache/jdo/tck/
tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/
tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/company/
tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/
tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/inheritance/
tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/
tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/lifecycle/
tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/
tck20/test/jdo/datastoreidentity/ tck20/test/jdo/datastoreidentity/org/
tck20/test/jdo/datastoreidentity/org/apache/
tck20/test/jdo/datastoreidentity/org/apache/jdo/
tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/
tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/
tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/company/
tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/
tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/inheritance/
tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/
tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/
tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/
tck20/test/orm/ tck20/test/orm/applicationidentity/
tck20/test/orm/applicationidentity/org/
tck20/test/orm/applicationidentity/org/apache/
tck20/test/orm/applicationidentity/org/apache/jdo/
tck20/test/orm/applicationidentity/org/apache/jdo/tck/
tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/
tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/company/
tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/
tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/inheritance/
tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/
tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/lifecycle/
tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/mylib/
tck20/test/orm/datastoreidentity/ tck20/test/orm/datastoreidentity/org/
tck20/test/orm/datastoreidentity/org/apache/
tck20/test/orm/datastoreidentity/org/apache/jdo/
tck20/test/orm/datastoreidentity/org/apache/jdo/tck/
tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/
tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/company/
tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/
tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/inheritance/
tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/
tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/
tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/mylib/
tck20/test/sql/ tck20/test/sql/derby/
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionUserName.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionUserName.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionUserName.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionUserName.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,94 @@
+/*
+ * 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.api.persistencemanagerfactory;
+
+import java.util.Properties;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>Set ConnectionUserName of PersistenceManagerFactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.1-13,A11.1-14.
+ *<BR>
+ *<B>Assertion Description: </B>
+PersistenceManagerFactory.setConnectionUserName(String name) sets the
+value of the ConnectionUserName property (the name of the user establishing the connection).
+ */
+
+public class SetConnectionUserName extends JDO_Test {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertions A11.1-13,A11.1-14 (SetConnectionUserName) 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(SetConnectionUserName.class);
+ }
+
+ private PersistenceManagerFactory pmf;
+ private PersistenceManager pm;
+ private String pmfClass;
+ private String url;
+ private String username;
+ private String password;
+
+ private static String PMFCLASS = "javax.jdo.PersistenceManagerFactoryClass";
+ private static String URL = "javax.jdo.option.ConnectionURL";
+ private static String USERNAME = "javax.jdo.option.ConnectionUserName";
+ private static String PASSWORD = "javax.jdo.option.ConnectionPassword";
+
+
+ /** set ConnectionUserName value and get ConnectionUserName value to verify */
+ public void test() {
+ Properties props = loadProperties(PMFProperties);
+ pmfClass = props.getProperty(PMFCLASS);
+ url = props.getProperty(URL);
+ username = props.getProperty(USERNAME);
+ password = props.getProperty(PASSWORD);
+
+ try {
+ Class cl = Class.forName(pmfClass);
+ pmf = (PersistenceManagerFactory) cl.newInstance();
+ pmf.setConnectionUserName(username);
+ if (!username.equals(pmf.getConnectionUserName())) {
+ fail(ASSERTION_FAILED,
+ "ConnectionUserName " + username +
+ " not equal to value returned by PMF " +
+ pmf.getConnectionUserName());
+ }
+ }
+ catch (Exception ex) {
+ fail(ASSERTION_FAILED,
+ "Failed in setting ConnectionUserName " + ex);
+ }
+ if (debug)
+ logger.debug("ConnectionUserName: " + pmf.getConnectionUserName());
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionUserName.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetIgnoreCache.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetIgnoreCache.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetIgnoreCache.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetIgnoreCache.java Mon Apr 4 12:41:23 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.tck.api.persistencemanagerfactory;
+
+import java.util.Properties;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>Set IgnoreCache of persistencemanagerfactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.1-5.
+ *<BR>
+ *<B>Assertion Description: </B>
+PersistenceManagerFactory.setIgnoreCache(boolean flag) sets the value of the IgnoreCache property (the query mode that specifies whether cached instances are considered when evaluating the filter expression).
+ */
+
+/*
+ * Revision History
+ * ================
+ * Author : Linga Neerathilingam
+ * Date : 10/15/01
+ * Version : 1.0
+ *
+ */
+
+public class SetIgnoreCache extends JDO_Test {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A11.1-5 (SetIgnoreCache) 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(SetIgnoreCache.class);
+ }
+
+ private PersistenceManagerFactory pmf;
+ private PersistenceManager pm;
+ private String pmfClass;
+ private String url;
+ private String username;
+ private String password;
+
+ private static String PMFCLASS = "javax.jdo.PersistenceManagerFactoryClass";
+ private static String URL = "javax.jdo.option.ConnectionURL";
+ private static String USERNAME = "javax.jdo.option.ConnectionUserName";
+ private static String PASSWORD = "javax.jdo.option.ConnectionPassword";
+
+
+ /** set IgnoreCache to true or false and use getIgnoreCache value to verify */
+ public void test() {
+ Properties props = loadProperties(PMFProperties);
+ pmfClass = props.getProperty(PMFCLASS);
+ url = props.getProperty(URL);
+ username = props.getProperty(USERNAME);
+ password = props.getProperty(PASSWORD);
+
+ try {
+ Class cl = Class.forName(pmfClass);
+ pmf = (PersistenceManagerFactory) cl.newInstance();
+ pmf.setIgnoreCache(false);
+ if (pmf.getIgnoreCache() != false) {
+ fail(ASSERTION_FAILED,
+ "IgnoreCache set to false, value returned by PMF is " +
+ pmf.getIgnoreCache());
+ }
+ pmf.setIgnoreCache(true);
+ if (pmf.getIgnoreCache() != true) {
+ fail(ASSERTION_FAILED,
+ "IgnoreCache set to true, value returned by PMF is " +
+ pmf.getIgnoreCache());
+ }
+ } catch (Exception ex) {
+ fail(ASSERTION_FAILED,
+ "Failed in setting IgnoreCache" + ex);
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetIgnoreCache.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetMultithreaded.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetMultithreaded.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetMultithreaded.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetMultithreaded.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,104 @@
+/*
+ * 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.api.persistencemanagerfactory;
+
+import java.util.Properties;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>Set Multithreaded of persistencemanagerfactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.1-11,A11.1-12.
+ *<BR>
+ *<B>Assertion Description: </B>
+ *PersistenceManagerFactory.setMultithreaded(boolean flag) sets the value of the Multithreaded flag that indicates that the application will invoke methods or access fields of managed instances from multiple threads.
+ */
+
+/*
+ * Revision History
+ * ================
+ * Author : Linga Neerathilingam
+ * Date : 10/15/01
+ * Version : 1.0
+ *
+ */
+
+public class SetMultithreaded extends JDO_Test {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertions A11.1-11,A11.1-12 (SetMultithreaded) 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(SetMultithreaded.class);
+ }
+
+ private PersistenceManagerFactory pmf;
+ private PersistenceManager pm;
+ private String pmfClass;
+ private String url;
+ private String username;
+ private String password;
+
+ private static String PMFCLASS = "javax.jdo.PersistenceManagerFactoryClass";
+ private static String URL = "javax.jdo.option.ConnectionURL";
+ private static String USERNAME = "javax.jdo.option.ConnectionUserName";
+ private static String PASSWORD = "javax.jdo.option.ConnectionPassword";
+
+ /** set Multithreaded to true or false and use getMultithreaded value to verify */
+ public void test() {
+ Properties props = loadProperties(PMFProperties);
+ pmfClass = props.getProperty(PMFCLASS);
+ url = props.getProperty(URL);
+ username = props.getProperty(USERNAME);
+ password = props.getProperty(PASSWORD);
+
+ try {
+ Class cl = Class.forName(pmfClass);
+ pmf = (PersistenceManagerFactory) cl.newInstance();
+ pmf.setMultithreaded(true);
+ if (pmf.getMultithreaded() != true) {
+ fail(ASSERTION_FAILED,
+ "Multithreaded set to true, value returned by PMF is " +
+ pmf.getMultithreaded());
+ }
+ pmf.setMultithreaded(false);
+ if (pmf.getMultithreaded() != false) {
+ fail(ASSERTION_FAILED,
+ "Multithreaded set to false, value returned by PMF is " +
+ pmf.getMultithreaded());
+ }
+ }
+ catch (Exception ex) {
+ fail(ASSERTION_FAILED,
+ "Failed in setting Multithreaded " + ex);
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetMultithreaded.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetNonTransactionalRead.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetNonTransactionalRead.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetNonTransactionalRead.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetNonTransactionalRead.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,105 @@
+/*
+ * 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.api.persistencemanagerfactory;
+
+import java.util.Properties;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>Set NonTransactionalRead of persistencemanagerfactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.1-7,A11.1-8.
+ *<BR>
+ *<B>Assertion Description: </B>
+ *PersistenceManagerFactory.setNontransactionalRead(boolean flag) sets the value of the NontransactionalRead property (the PersistenceManager mode that allows instances to be read outside a transaction).
+ */
+
+/*
+ * Revision History
+ * ================
+ * Author : Linga Neerathilingam
+ * Date : 10/15/01
+ * Version : 1.0
+ *
+ */
+
+public class SetNonTransactionalRead extends JDO_Test {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertions A11.1-7,A11.1-8 (SetNonTransactionalRead) 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(SetNonTransactionalRead.class);
+ }
+
+ private PersistenceManagerFactory pmf;
+ private PersistenceManager pm;
+ private String pmfClass;
+ private String url;
+ private String username;
+ private String password;
+
+ private static String PMFCLASS = "javax.jdo.PersistenceManagerFactoryClass";
+ private static String URL = "javax.jdo.option.ConnectionURL";
+ private static String USERNAME = "javax.jdo.option.ConnectionUserName";
+ private static String PASSWORD = "javax.jdo.option.ConnectionPassword";
+
+
+ /** set NonTransactionalRead to true or false and use getNonTransactionalRead value to verify */
+ public void test() {
+ Properties props = loadProperties(PMFProperties);
+ pmfClass = props.getProperty(PMFCLASS);
+ url = props.getProperty(URL);
+ username = props.getProperty(USERNAME);
+ password = props.getProperty(PASSWORD);
+
+ try {
+ Class cl = Class.forName(pmfClass);
+ pmf = (PersistenceManagerFactory) cl.newInstance();
+ pmf.setNontransactionalRead(false);
+ if (pmf.getNontransactionalRead() != false) {
+ fail(ASSERTION_FAILED,
+ "NonTransactionalRead set to false, value returned by PMF is " +
+ pmf.getNontransactionalRead());
+ }
+ pmf.setNontransactionalRead(true);
+ if (pmf.getNontransactionalRead() != true) {
+ fail(ASSERTION_FAILED,
+ "NonTransactionalRead set to true, value returned by PMF is " +
+ pmf.getNontransactionalRead());
+ }
+ }
+ catch (Exception ex) {
+ fail(ASSERTION_FAILED,
+ "Failed in setting NonTransactionalRead " + ex);
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetNonTransactionalRead.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetNonTransactionalWrite.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetNonTransactionalWrite.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetNonTransactionalWrite.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetNonTransactionalWrite.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,104 @@
+/*
+ * 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.api.persistencemanagerfactory;
+
+import java.util.Properties;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>Set NonTransactionalWrite of persistencemanagerfactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.1-9,A11.1-10.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * PersistenceManagerFactory.setNontransactionalWrite(boolean flag) sets the value of the NontransactionalWrite property (the PersistenceManager mode that allows instances to be written outside a transaction).
+ */
+
+/*
+ * Revision History
+ * ================
+ * Author : Linga Neerathilingam
+ * Date : 10/15/01
+ * Version : 1.0
+ *
+ */
+
+public class SetNonTransactionalWrite extends JDO_Test {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertions A11.1-9,A11.1-10 (SetNonTransactionalWrite) 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(SetNonTransactionalWrite.class);
+ }
+
+ private PersistenceManagerFactory pmf;
+ private PersistenceManager pm;
+ private String pmfClass;
+ private String url;
+ private String username;
+ private String password;
+
+ private static String PMFCLASS = "javax.jdo.PersistenceManagerFactoryClass";
+ private static String URL = "javax.jdo.option.ConnectionURL";
+ private static String USERNAME = "javax.jdo.option.ConnectionUserName";
+ private static String PASSWORD = "javax.jdo.option.ConnectionPassword";
+
+
+ /** set NonTransactionalWrite to true or false and use getNonTransactionalWrite value to verify */
+ public void test () {
+ Properties props = loadProperties(PMFProperties);
+ pmfClass = props.getProperty(PMFCLASS);
+ url = props.getProperty(URL);
+ username = props.getProperty(USERNAME);
+ password = props.getProperty(PASSWORD);
+
+ try {
+ Class cl = Class.forName(pmfClass);
+ pmf = (PersistenceManagerFactory) cl.newInstance();
+ pmf.setNontransactionalWrite(false);
+ if (pmf.getNontransactionalWrite() != false) {
+ fail(ASSERTION_FAILED,
+ "NonTransactionalWrite set to false, value returned by PMF is " +
+ pmf.getNontransactionalWrite());
+ }
+ pmf.setNontransactionalWrite(true);
+ if (pmf.getNontransactionalWrite() != true) {
+ fail(ASSERTION_FAILED,
+ "NonTransactionalWrite set to true, value returned by PMF is " +
+ pmf.getNontransactionalWrite());
+ }
+ } catch (Exception ex) {
+ fail(ASSERTION_FAILED,
+ "Failed in setting NonTransactionalWrite " + ex);
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetNonTransactionalWrite.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetOptimistic.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetOptimistic.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetOptimistic.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetOptimistic.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,102 @@
+/*
+ * 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.api.persistencemanagerfactory;
+
+import java.util.Properties;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>Set optimistic of persistencemanagerfactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.1-1, A11.1-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+ PersistenceManagerFactory.getOptimistic() returns Value of the Optimistic property,persistenceManagerFactory.setOptimistic(boolean flag) sets
+the value of the Optimistic property (the transaction mode that specifies concurrency control
+ */
+
+public class SetOptimistic extends JDO_Test {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A11.1-1, A11.1-2 (SetOptimistic) 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(SetOptimistic.class);
+ }
+
+ private PersistenceManagerFactory pmf;
+ private PersistenceManager pm;
+ private String pmfClass;
+ private String url;
+ private String username;
+ private String password;
+
+ private static String PMFCLASS = "javax.jdo.PersistenceManagerFactoryClass";
+ private static String URL = "javax.jdo.option.ConnectionURL";
+ private static String USERNAME = "javax.jdo.option.ConnectionUserName";
+ private static String PASSWORD = "javax.jdo.option.ConnectionPassword";
+
+ /** set Optimistic to true or false and use getOptimistic value to verify */
+ public void test() {
+ if (!isOptimisticSupported()) {
+ if (debug)
+ logger.debug("\n SetOptimistic() passed: this implementation does not support Optimistic.");
+ return;
+ }
+
+ Properties props = loadProperties(PMFProperties);
+ pmfClass = props.getProperty(PMFCLASS);
+ url = props.getProperty(URL);
+ username = props.getProperty(USERNAME);
+ password = props.getProperty(PASSWORD);
+
+ try {
+ Class cl = Class.forName(pmfClass);
+ pmf = (PersistenceManagerFactory) cl.newInstance();
+ pmf.setOptimistic(false);
+ if (pmf.getOptimistic() != false) {
+ fail(ASSERTION_FAILED,
+ "Optimistic set to false, value returned by PMF is " +
+ pmf.getOptimistic());
+ }
+ pmf.setOptimistic(true);
+ if (pmf.getOptimistic() != true) {
+ fail(ASSERTION_FAILED,
+ "Optimistic set to true, value returned by PMF is " +
+ pmf.getOptimistic());
+ }
+ }
+ catch (Exception ex) {
+ fail(ASSERTION_FAILED,
+ "Failed in setting Optimistic " + ex);
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetOptimistic.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetRetainValues.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetRetainValues.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetRetainValues.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetRetainValues.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,104 @@
+/*
+ * 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.api.persistencemanagerfactory;
+
+import java.util.Properties;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>Set RetainValues of persistencemanagerfactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.1-3,A11.1-4.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * PersistenceManagerFactory.setRetainValues(boolean flag) sets the value of the RetainValues property (the transaction mode that specifies the treatment of persistent instances after commit),
+PersistenceManagerFactory.getRetainValues() returns the value of the
+RetainValues property.
+ */
+
+/*
+ * Revision History
+ * ================
+ * Author : Linga Neerathilingam
+ * Date : 10/18/01
+ * Version : 1.0
+ *
+ */
+
+public class SetRetainValues extends JDO_Test {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A11.1-3,A11.1-4 (SetRetainValues) 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(SetRetainValues.class);
+ }
+
+ private PersistenceManagerFactory pmf;
+ private PersistenceManager pm;
+ private String pmfClass;
+ private String url;
+ private String username;
+ private String password;
+
+ private static String PMFCLASS = "javax.jdo.PersistenceManagerFactoryClass";
+ private static String URL = "javax.jdo.option.ConnectionURL";
+ private static String USERNAME = "javax.jdo.option.ConnectionUserName";
+ private static String PASSWORD = "javax.jdo.option.ConnectionPassword";
+
+ /** set RetainValues to true or false and use getRetainValues value to verify */
+ public void test() {
+ Properties props = loadProperties(PMFProperties);
+ pmfClass = props.getProperty(PMFCLASS);
+ url = props.getProperty(URL);
+ username = props.getProperty(USERNAME);
+ password = props.getProperty(PASSWORD);
+
+ try {
+ Class cl = Class.forName(pmfClass);
+ pmf = (PersistenceManagerFactory) cl.newInstance();
+ pmf.setRetainValues(false);
+ if (pmf.getRetainValues() != false) {
+ fail(ASSERTION_FAILED,
+ "RetainValues set to false, value returned by PMF is " +
+ pmf.getRetainValues());
+ }
+ pmf.setRetainValues(true);
+ if (pmf.getRetainValues() != true) {
+ fail(ASSERTION_FAILED,
+ "RetainValues set to true, value returned by PMF is " +
+ pmf.getRetainValues());
+ }
+ } catch (Exception ex) {
+ fail(ASSERTION_FAILED,
+ "Failed in setting RetainValues " + ex);
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetRetainValues.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SupportedOptions.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SupportedOptions.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SupportedOptions.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SupportedOptions.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,75 @@
+/*
+ * 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.api.persistencemanagerfactory;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>SupportedOptions of persistencemanagerfactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.5-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * PersistenceManagerFactory.supportedOptions() returns a Collection
+of String, each String instance representing an optional feature of the
+implementation or a supported query language.
+ */
+
+/*
+ * Revision History
+ * ================
+ * Author : Linga Neerathilingam
+ * Date : 10/22/01
+ *
+ */
+
+public class SupportedOptions extends JDO_Test {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A11.5-1 (SupportedOptions) 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(SupportedOptions.class);
+ }
+
+ /** */
+ public void test() {
+ PersistenceManagerFactory pmf = getPMF();
+ if (debug) logger.debug("Options supported by this implementation:");
+ Collection c = pmf.supportedOptions();
+ Iterator iter = c.iterator();
+ while( iter.hasNext() ){
+ String option = (String) iter.next();
+ if (debug) logger.debug(option);
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SupportedOptions.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/EnhancerTest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/EnhancerTest.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/EnhancerTest.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/EnhancerTest.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,100 @@
+/*
+ * 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.
+ */
+
+/*
+ * EnhancerTest.java
+ *
+ * Created on February 17, 2002, 1:59 PM
+ */
+
+package org.apache.jdo.tck.enhancement;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import org.apache.jdo.tck.JDO_Test;
+
+/**
+ *
+ * @author Craig Russell
+ * @version 1.0
+ */
+public abstract class EnhancerTest extends JDO_Test {
+
+ /** Creates new EnhancerTest */
+ public EnhancerTest() {
+ }
+
+ /** */
+ protected Properties getProperties(String resourceName) {
+ Properties props = null;
+ try {
+ InputStream in = this.getClass().getClassLoader().getResourceAsStream(resourceName);
+ props = new Properties();
+ props.load(in);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ fail("EnhancerTest:",
+ "Error loading properties " + resourceName + " exception " + ex);
+ }
+ return props;
+ }
+
+ /** */
+ protected abstract void runTestOnePackage (String packageName, List fullyQualifiedClassNameList);
+
+ /** */
+ protected String convertClassName (String packageName, String className) {
+ return packageName + "." + className;
+ }
+
+ /** */
+ void runTestAllPackages() {
+ /** First, get classes to test from properties file.
+ */
+ Properties classesToTest = getProperties("enhancement-test.properties"); //NOI18N
+
+ Enumeration enum = classesToTest.propertyNames();
+ int numberOfPackages = 0;
+
+ /** Each key is a package name; the value is a list of class names to test.
+ */
+ while (enum.hasMoreElements()) {
+ ++numberOfPackages;
+ String packageName = (String) enum.nextElement();
+ if (debug) logger.debug("EnhancerTest Package: " + packageName);
+ String classNames = (String) classesToTest.get(packageName);
+ if (debug) logger.debug("EnhancerTest Classes: " + classNames);
+ StringTokenizer st = new StringTokenizer(classNames, " ,");
+ ArrayList classNameList = new ArrayList();
+ /** Each entry is a list of class names separated by comma or space
+ */
+ while (st.hasMoreTokens()) {
+ String className = st.nextToken();
+ String listEntry = convertClassName(packageName, className);
+ classNameList.add (listEntry);
+ if (debug) logger.debug("EnhancerTest Class: " + className);
+ }
+ runTestOnePackage (packageName, classNameList);
+ }
+ if (debug) logger.debug("EnhancerTest numberOfPackages: " + numberOfPackages);
+ return;
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/EnhancerTest.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/FieldAccessModified.java.fix
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/FieldAccessModified.java.fix?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/FieldAccessModified.java.fix (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/FieldAccessModified.java.fix Mon Apr 4 12:41:23 2005
@@ -0,0 +1,107 @@
+/*
+ * 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();
+ cleanup();
+ }
+
+ /** */
+ 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.");
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/FieldAccessModified.java.fix
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/ImplementsPersistenceCapable.java.fix
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/ImplementsPersistenceCapable.java.fix?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/ImplementsPersistenceCapable.java.fix (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/ImplementsPersistenceCapable.java.fix Mon Apr 4 12:41:23 2005
@@ -0,0 +1,100 @@
+/*
+ * 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>"implements javax.jdo.PersistenceCapable</code>"
+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();
+ cleanup();
+ }
+
+ /** */
+ 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.");
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/enhancement/ImplementsPersistenceCapable.java.fix
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseAll.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseAll.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseAll.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseAll.java Mon Apr 4 12:41:23 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.
+ */
+
+
+package org.apache.jdo.tck.extents;
+
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> CloseAll
+ *<BR>
+ *<B>Keywords:</B> extent
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-12.
+ *<BR>
+ *<B>Assertion Description: </B>
+After a call to <code>Extent.closeAll()</code>, all iterators acquired from this
+<code>Extent</code> will return <code>false</code> to <code>hasNext()</code>.
+
+ */
+
+public class CloseAll extends ExtentTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A15.3-12 (CloseAll) 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(CloseAll.class);
+ }
+
+ /** */
+ public void test() {
+ try {
+ beginTransaction();
+ Extent ex = getPM().getExtent (Employee.class, true);
+ Iterator it1 = ex.iterator();
+ deleteEmployee((Employee)it1.next());
+ Iterator it2 = ex.iterator();
+ addEmployee();
+ Iterator it3 = ex.iterator();
+ ex.closeAll();
+ if (it1.hasNext()) {
+ fail(ASSERTION_FAILED,
+ "After extent.closeAll() iterator1.hasNext(): " + it1.hasNext());
+ }
+ if (it2.hasNext()) {
+ fail(ASSERTION_FAILED,
+ "After extent.closeAll() iterator2.hasNext(): " + it2.hasNext());
+ }
+ if (it3.hasNext()) {
+ fail(ASSERTION_FAILED,
+ "After extent.closeAll() iterator3.hasNext(): " + it3.hasNext());
+ }
+ if (debug) logger.debug("Assertion A15.3-12 passed");
+ }
+ finally {
+ rollbackTransaction();
+ cleanup();
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseAll.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseOfExtentIteratorIsIteratorSpecific.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseOfExtentIteratorIsIteratorSpecific.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseOfExtentIteratorIsIteratorSpecific.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseOfExtentIteratorIsIteratorSpecific.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,77 @@
+/*
+ * 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.extents;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+import javax.jdo.Query;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B> Close of Extent Iterator is Iterator Specific
+ *<BR>
+ *<B>Keywords:</B> extent
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-11.
+ *<BR>
+ *<B>Assertion Description: </B>
+After a call to <code>Extent.close(Iterator i)</code>,
+the <code>Extent</code> itself can still be used to acquire other
+iterators and can be used as the <code>Extent</code> for queries.
+
+ */
+
+public class CloseOfExtentIteratorIsIteratorSpecific extends ExtentTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A15.3-11 (CloseOfExtentIteratorIsIteratorSpecific) 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(CloseOfExtentIteratorIsIteratorSpecific.class);
+ }
+
+ /** */
+ public void test() {
+ Extent ex = getExtent();
+ Iterator it1 = ex.iterator();
+ ex.close(it1);
+ int count = countIterator(ex.iterator());
+ if (count != 2) {
+ fail(ASSERTION_FAILED,
+ "iterating Employees after close of first iterator; counted " + count + " instances; should be 2");
+ }
+ Query q = getPM().newQuery(ex);
+ Collection c = (Collection)q.execute();
+ int count2 = countIterator(c.iterator());
+ if (count2 != 2) {
+ fail(ASSERTION_FAILED,
+ "in query after closing iterator; counted " + count + " instances; should be 2");
+ }
+ if (debug) logger.debug("Assertion A15.3-11 passed");
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/CloseOfExtentIteratorIsIteratorSpecific.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/ExtentTest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/ExtentTest.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/ExtentTest.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/ExtentTest.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,260 @@
+/*
+ * 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.extents;
+
+
+import java.lang.reflect.Constructor;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.TimeZone;
+
+import javax.jdo.Extent;
+import javax.jdo.JDOFatalInternalException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.company.Address;
+import org.apache.jdo.tck.pc.company.Company;
+import org.apache.jdo.tck.pc.company.Department;
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.pc.company.FullTimeEmployee;
+import org.apache.jdo.tck.pc.company.DentalInsurance;
+import org.apache.jdo.tck.pc.company.MedicalInsurance;
+import org.apache.jdo.tck.pc.company.PartTimeEmployee;
+import org.apache.jdo.tck.pc.company.Project;
+
+/**
+ *
+ * @author Craig Russell
+ * @version 1.0
+ */
+abstract class ExtentTest extends JDO_Test {
+
+ protected Class extentClass = Employee.class;
+ protected Company company;
+ protected Object companyOID;
+
+ /** Creates new ExtentTest */
+ public ExtentTest() {
+ if (PMFProperties == null)
+ {
+ PMFProperties = System.getProperty("user.home") + "/.jdo/PMFProperties.properties";
+ if (PMFProperties == null)
+ System.out.println ("Please specify PMF properties in {user.home}/.jdo/PMFProperties.properties");
+ }
+ }
+
+ /** */
+ protected void checkPM() {
+ try {
+ Extent ex = getPM().getExtent(Company.class, false);
+ int count = countIterator(ex.iterator());
+ if (count == 1) {
+ if (debug) logger.debug ("Found company");
+ return;
+ }
+ } catch (Exception e) {
+ e.printStackTrace(System.err);
+ System.err.println ("Failed to find Company; initializing DB");
+ }
+ initDB();
+ }
+
+ /** */
+ protected void initDB() {
+ HashSet h;
+ Address addr1 = new Address (7001L, "18 Network Circle",
+ "Santa Clara", "CA", "94455", "USA");
+ company = new Company (1L, "Sun Microsystems", new Date(), addr1);
+ GregorianCalendar born =
+ new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles"));
+ GregorianCalendar hired =
+ new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles"));
+
+ born.set(1969, 7, 20);
+ hired.set(1982, 5, 5);
+ Address addr2 = new Address (7002L, "43 Sematery Drive",
+ "Woodside", "CA", "94320", "USA");
+ Employee scott = new FullTimeEmployee(3001L, "Scott", "McNealy", "G",
+ born.getTime(), addr2,
+ hired.getTime(), 200000.0);
+ born.set(1960, 4, 8);
+ hired.set(1985, 2, 3);
+ Address addr3 = new Address (7003L, "1298 Wanderlust Road",
+ "Pleasanton", "CA", "95560", "USA");
+ Employee ed = new PartTimeEmployee(3002L, "Ed", "Zander", null,
+ born.getTime(), addr3,
+ hired.getTime(), 400000.0);
+ scott.addToTeam(ed);
+
+ // Set up their departments.
+ Department board =
+ new Department(2001L, "board", company);
+ h = new HashSet();
+ h.add(scott);
+ board.setEmployees(h);
+ scott.setDepartment(board);
+
+ company.addDepartment(board);
+
+ Department emg = new Department(2002L, "emg", company);
+ h = new HashSet();
+ h.add(ed);
+ emg.setEmployees(h);
+ ed.setDepartment(emg);
+
+ company.addDepartment(emg);
+
+ // Insure these guys
+ DentalInsurance scottDentalIns = new DentalInsurance(
+ 5001L, "Aetna", scott, new BigDecimal("12000"));
+ MedicalInsurance scottMedicalIns = new MedicalInsurance(
+ 5002L, "Aetna", scott, "PPO");
+ DentalInsurance edDentalIns = new DentalInsurance(
+ 5003L, "BlueCross", ed, new BigDecimal("10000"));
+ MedicalInsurance edMedicalIns = new MedicalInsurance(
+ 5004L, "BlueCross", ed, "EPO");
+ scott.setDentalInsurance(scottDentalIns);
+ scott.setMedicalInsurance(scottMedicalIns);
+ ed.setDentalInsurance(edDentalIns);
+ ed.setMedicalInsurance(edMedicalIns);
+
+ // Give them some projects to work on. Scott works on both; Ed only
+ // on one.
+ Project solaris = new Project(4001L, "Solaris", new BigDecimal(100.375));
+ Project sparc = new Project(4002L, "Sparc", new BigDecimal(200.500));
+ h = new HashSet();
+ h.add(scott);
+ h.add(ed);
+ solaris.setMembers(h); // Solaris is worked on by Scott and Ed
+
+ h = new HashSet();
+ h.add(scott);
+ sparc.setMembers(h); // Sparc is worked on by Scott
+
+ h = new HashSet();
+ h.add(solaris);
+ h.add(sparc);
+ scott.setProjects(h); // Scott works on Solaris and Sparc
+
+ h = new HashSet();
+ h.add(solaris);
+ ed.setProjects(h); // Ed works on Solaris
+
+ /* Now put all of these into the database
+ */
+ pm.currentTransaction().begin();
+ pm.makePersistent (company);
+ pm.currentTransaction().commit();
+ // System.out.println ("Company OID: " + pm.getObjectId(company));
+ }
+
+ /** */
+ protected Employee addEmployee() {
+ Address addr1 = new Address (7004L, "456 Chelsey Lane",
+ "Mountain View", "CA", "94040", "USA");
+ Employee emp1 = new FullTimeEmployee (3003L, "First3003", "Last3003", "Middle3003",
+ new Date(), addr1, new Date(), 10000.0);
+ getPM().makePersistent (emp1);
+ return emp1;
+ }
+
+ /** */
+ protected void deleteEmployee(Employee e) {
+ getPM().deletePersistent (e);
+ }
+
+ /** */
+ protected int countIterator(Iterator it) {
+ int count = 0;
+ for (;it.hasNext();count++, it.next());
+ return count;
+ }
+
+ /** */
+ protected int printIterator(Iterator it) {
+ int count = 0;
+ for (;it.hasNext();count++) {
+ System.out.println (it.next().toString());
+ }
+ return count;
+ }
+
+ /** */
+ protected Extent getExtent() {
+ return getPM().getExtent(extentClass, true);
+ }
+
+ /** */
+ protected Object getCompanyOID () {
+ String companyOIDString = (String)
+ PMFPropertiesObject.get("org.apache.jdo.tck.extents.CompanyOID");
+ String companyOIDClassName = (String)
+ PMFPropertiesObject.get("org.apache.jdo.tck.extents.CompanyOIDClass");
+ if (companyOIDClassName == null) {
+ companyOIDClassName = "org.apache.jdo.impl.fostore.OID";
+ }
+ try {
+ Class companyOIDClass = Class.forName(companyOIDClassName);
+ Constructor companyOIDConstructor = companyOIDClass.getConstructor(new Class[] {String.class});
+ Object companyOID = companyOIDConstructor.newInstance (new Object[] {companyOIDString});
+ return companyOID;
+ }
+ catch (Exception ex) {
+ throw new JDOFatalInternalException (
+ "PMFProperties must be configured with the following properties\n" +
+ "\torg.apache.jdo.tck.extents.CompanyOID = <string result of oid.toString()>\n" +
+ "\torg.apache.jdo.tck.extents.CompanyOIDClass = <name of companyOID class>\n", ex);
+ }
+ }
+
+ /** */
+ protected PersistenceManager getPM() {
+ if (pm == null) {
+ pm = getPMF().getPersistenceManager();
+ checkPM();
+ }
+ return pm;
+ }
+
+ /** */
+ public PersistenceManagerFactory getPMF() {
+ if (pmf == null) {
+ pmf = super.getPMF();
+ }
+ return pmf;
+ }
+
+ /** */
+ protected void beginTransaction() {
+ getPM().currentTransaction().begin();
+ }
+
+ /** */
+ protected void commitTransaction() {
+ getPM().currentTransaction().commit();
+ }
+
+ /** */
+ protected void rollbackTransaction() {
+ getPM().currentTransaction().rollback();
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/ExtentTest.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetCandidateClass.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetCandidateClass.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetCandidateClass.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetCandidateClass.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,60 @@
+/*
+ * 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.extents;
+
+import javax.jdo.Extent;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get Candidate Class
+ *<BR>
+ *<B>Keywords:</B> extent
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-7.
+ *<BR>
+ *<B>Assertion Description: </B>
+<code>Extent.getCandidateClass()</code> returns the class of the instances
+contained in this <code>Extent</code>.
+
+ */
+
+public class GetCandidateClass extends ExtentTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A15.3-7 (GetCandidateClass) 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(GetCandidateClass.class);
+ }
+
+ /** */
+ public void test() {
+ Extent ex = getExtent();
+ if (extentClass != ex.getCandidateClass()) {
+ fail(ASSERTION_FAILED,
+ "Candidate class in extent should be: " + extentClass.getClass().getName());
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetCandidateClass.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetPersistenceManager.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetPersistenceManager.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetPersistenceManager.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,62 @@
+/*
+ * 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.extents;
+
+import javax.jdo.Extent;
+
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get PersistenceManager
+ *<BR>
+ *<B>Keywords:</B> extent
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-8.
+ *<BR>
+ *<B>Assertion Description: </B>
+<code>Extent.getPersistenceManager()</code> returns the
+<code>PersistenceManager</code> which created this <code>Extent</code>.
+
+ */
+
+public class GetPersistenceManager extends ExtentTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A15.3-8 (GetPersistenceManager) 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(GetPersistenceManager.class);
+ }
+
+ /** */
+ public void test() {
+ Extent ex = getPM().getExtent (Employee.class, true);
+ if (pm != ex.getPersistenceManager()) {
+ fail(ASSERTION_FAILED,
+ "unexpected pm of extent, expected " + pm +
+ ", got " + ex.getPersistenceManager());
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/GetPersistenceManager.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubclassesFalse.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubclassesFalse.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubclassesFalse.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubclassesFalse.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,61 @@
+/*
+ * 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.extents;
+
+import javax.jdo.Extent;
+
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Has Subclasses is False
+ *<BR>
+ *<B>Keywords:</B> extent inheritance
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-5.
+ *<BR>
+ *<B>Assertion Description: </B>
+<code>Extent.hasSubclasses()</code> returns <code>false</code>
+if the extent does not include subclasses.
+
+ */
+
+public class HasSubclassesFalse extends ExtentTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A15.3-5 (HasSubclassesFalse) 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(HasSubclassesFalse.class);
+ }
+
+ /** */
+ public void test() {
+ Extent ex = getPM().getExtent (Employee.class, false);
+ if (ex.hasSubclasses()) {
+ fail(ASSERTION_FAILED,
+ "ex.hasSubclasses() returned true, but extent was created with subclasses=false.");
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubclassesFalse.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubclassesTrue.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubclassesTrue.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubclassesTrue.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubclassesTrue.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,61 @@
+/*
+ * 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.extents;
+
+import javax.jdo.Extent;
+
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Has Subclasses is True
+ *<BR>
+ *<B>Keywords:</B> extent inheritance
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-6.
+ *<BR>
+ *<B>Assertion Description: </B>
+<code>Extent.hasSubclasses()</code> returns <code>true</code>
+if the extent includes subclasses.
+
+ */
+
+public class HasSubclassesTrue extends ExtentTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A15.3-6 (HasSubclassesTrue) 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(HasSubclassesTrue.class);
+ }
+
+ /** */
+ public void test() {
+ Extent ex = getPM().getExtent (Employee.class, true);
+ if (!ex.hasSubclasses()) {
+ fail(ASSERTION_FAILED,
+ "ex.hasSubclasses() returned false, but extent was created with subclasses=true.");
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/HasSubclassesTrue.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/InstancesDeletedPriorToIterationNotReturned.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/InstancesDeletedPriorToIterationNotReturned.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/InstancesDeletedPriorToIterationNotReturned.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/InstancesDeletedPriorToIterationNotReturned.java Mon Apr 4 12:41:23 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.
+ */
+
+
+package org.apache.jdo.tck.extents;
+
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Instances Deleted Prior to Iteration not Returned
+ *<BR>
+ *<B>Keywords:</B> extent
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-3.
+ *<BR>
+ *<B>Assertion Description: </B>
+If instances were deleted in the transaction prior to the execution of
+<code>Extent.iterator()</code>, the returned <code>Iterator</code>
+will not contain the instances.
+
+ */
+
+public class InstancesDeletedPriorToIterationNotReturned extends ExtentTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A15.3-3 (InstancesDeletedPriorToIterationNotReturned) 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(InstancesDeletedPriorToIterationNotReturned.class);
+ }
+
+ /** */
+ public void test() {
+ try {
+ beginTransaction();
+ getPM().setIgnoreCache(false);
+ Extent ex = getPM().getExtent (Employee.class, true);
+ Iterator it1 = ex.iterator();
+ deleteEmployee((Employee)it1.next());
+ Iterator it2 = ex.iterator();
+ int count = countIterator(it2);
+ rollbackTransaction();
+
+ Iterator it3 = ex.iterator();
+ int count3 = countIterator(it3);
+
+ if (count != 1) {
+ fail(ASSERTION_FAILED,
+ "counted " + count + " after delete; should be 1");
+ }
+ if (count3 != 2) {
+ fail(ASSERTION_FAILED,
+ "counted " + count3 + "after rollback; should be 2");
+ }
+ }
+ finally {
+ cleanup();
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/InstancesDeletedPriorToIterationNotReturned.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/InstancesPersistedPriorToIterationReturned.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/InstancesPersistedPriorToIterationReturned.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/InstancesPersistedPriorToIterationReturned.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/InstancesPersistedPriorToIterationReturned.java Mon Apr 4 12:41:23 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.
+ */
+
+
+package org.apache.jdo.tck.extents;
+
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Instances Persisted Prior to Iteration Returned
+ *<BR>
+ *<B>Keywords:</B> extent
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+If instances were made persistent in the transaction prior to the execution of
+<code>Extent.iterator()</code>, the returned <code>Iterator</code>
+will contain the instances.
+
+ */
+
+public class InstancesPersistedPriorToIterationReturned extends ExtentTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A15.3-2 (InstancesPersistedPriorToIterationReturned) 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(InstancesPersistedPriorToIterationReturned.class);
+ }
+
+ /** */
+ public void test() {
+
+ try {
+ beginTransaction();
+ getPM().setIgnoreCache(false);
+ Extent ex = getPM().getExtent (Employee.class, true);
+ addEmployee();
+ Iterator it = ex.iterator();
+ int count = countIterator(it);
+ rollbackTransaction();
+
+ Iterator it2 = ex.iterator();
+ int count2 = countIterator(it2);
+
+ if (count != 3) {
+ fail(ASSERTION_FAILED,
+ "Iterator: " + count + " should be 3");
+ }
+ if (count2 != 2) {
+ fail(ASSERTION_FAILED,
+ "Iterator2: " + count2 + "should be 2");
+ }
+ }
+ finally {
+ cleanup();
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/InstancesPersistedPriorToIterationReturned.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/IteratorHasNextFalseAfterExtentClose.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/IteratorHasNextFalseAfterExtentClose.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/IteratorHasNextFalseAfterExtentClose.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/IteratorHasNextFalseAfterExtentClose.java Mon Apr 4 12:41:23 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.tck.extents;
+
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Iterator HasNext returns False after Extent.close
+ *<BR>
+ *<B>Keywords:</B> extent
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-9.
+ *<BR>
+ *<B>Assertion Description: </B>
+After a call to <code>Extent.close(Iterator i)</code>,
+the parameter <code>Iterator</code> will return <code>false</code>
+to <code>hasNext()</code>.
+
+ */
+
+public class IteratorHasNextFalseAfterExtentClose extends ExtentTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A15.3-9 (IteratorHasNextFalseAfterExtentClose) 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(IteratorHasNextFalseAfterExtentClose.class);
+ }
+
+ /** */
+ public void test() {
+
+ try {
+ beginTransaction();
+ Extent ex = getPM().getExtent (Employee.class, true);
+ Iterator it1 = ex.iterator();
+ deleteEmployee((Employee)it1.next());
+ Iterator it2 = ex.iterator();
+ addEmployee();
+ Iterator it3 = ex.iterator();
+ ex.close(it1);
+ ex.close(it2);
+ ex.close(it3);
+ rollbackTransaction();
+
+ Iterator it4 = ex.iterator();
+ int count4 = countIterator(it4);
+ if (debug) logger.debug ("Iterator4 after rollback: " + count4);
+
+ if (it1.hasNext()) {
+ fail(ASSERTION_FAILED,
+ "iterator1.hasNext(): " + it1.hasNext());
+ }
+ if (it2.hasNext()) {
+ fail(ASSERTION_FAILED,
+ "iterator2.hasNext(): " + it2.hasNext());
+ }
+ if (it3.hasNext()) {
+ fail(ASSERTION_FAILED,
+ "iterator3.hasNext(): " + it3.hasNext());
+ }
+ if (count4 != 2) {
+ fail(ASSERTION_FAILED,
+ "Iterator " + count4 + " should be 2");
+ }
+ }
+ finally {
+ cleanup();
+ }
+ }
+}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/IteratorHasNextFalseAfterExtentClose.java
------------------------------------------------------------------------------
svn:executable = *
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/IteratorMutatingMethods.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/IteratorMutatingMethods.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/IteratorMutatingMethods.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/extents/IteratorMutatingMethods.java Mon Apr 4 12:41:23 2005
@@ -0,0 +1,73 @@
+/*
+ * 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.extents;
+
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Iterator Mutating Methods
+ *<BR>
+ *<B>Keywords:</B> extent exception
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-4.
+ *<BR>
+ *<B>Assertion Description: </B>
+If any mutating method, including the <code>remove</code> method,
+is called on the <code>Iterator</code> returned by <code>Extent.iterator()</code>,
+an <code>UnsupportedOperationException</code> is thrown.
+
+ */
+
+public class IteratorMutatingMethods extends ExtentTest {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A15.3-4 (IteratorMutatingMethods) 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(IteratorMutatingMethods.class);
+ }
+
+ /** */
+ public void test() {
+ Extent ex = getExtent();
+ Iterator it = ex.iterator();
+ it.next();
+ try {
+ it.remove();
+ fail(ASSERTION_FAILED,
+ "extent.iterator().remove() should throw UnsupportedOperationException");
+ }
+ catch (UnsupportedOperationException expected) {
+ // expected exception
+ if (debug) logger.debug("expected exception " + ex);
+ }
+ finally {
+ cleanup();
+ }
+ }
+}