--
-------------------------------------------------------------------
Michael Watzek [EMAIL PROTECTED] Engineering GmbH
mailto:[EMAIL PROTECTED] Buelowstr. 66
Tel.: ++49/30/235 520 36 10783 Berlin - Germany
Fax.: ++49/30/217 520 12 http://www.spree.de/
-------------------------------------------------------------------
Index:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AbstractGetPMF.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AbstractGetPMF.java
(revision 0)
+++
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AbstractGetPMF.java
(revision 0)
@@ -0,0 +1,98 @@
+/*
+ * 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 javax.jdo.JDOFatalUserException;
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+
+/**
+ * The abstract super class for all GetPMF test cases.
+ * @author Michael Watzek
+ */
+
+abstract class AbstractGetPMF extends JDO_Test {
+
+ protected static final String nameExists =
+ System.getProperty("PMFProperties");
+
+ protected static final String nameDoesNotExist =
+ //we use '/' instead of File.separatorChar because
+ //this character is passed by maven
+ nameExists.substring(0, nameExists.lastIndexOf('/')+1) +
+ "logging.properties";
+
+ protected static final String jndiName =
+ //we use '/' instead of File.separatorChar because
+ //this character is passed by maven
+ nameExists.substring(0, nameExists.lastIndexOf('/')+1) +
+ "pmf.ser";
+
+ /**
+ * Removing the path prefix from argument <code>name</code>.
+ * @return argument <code>name</code> removed by the path prefix.
+ */
+ protected String removePathPrefix(String name) {
+ //we use '/' instead of File.separatorChar because
+ //this character is passed by maven
+ int index = name.lastIndexOf('/');
+ if (index!=-1) {
+ name = name.substring(index+1);
+ }
+ return name;
+ }
+
+ protected void makePersistent() {
+ pm = pmf.getPersistenceManager();
+ Transaction tx = pm.currentTransaction();
+ tx.begin();
+ PCPoint comp = new PCPoint(1, 2);
+ pm.makePersistent(comp);
+ tx.commit();
+ addTearDownInstance(comp);
+ }
+
+ /**
+ * Returns pmf instance for the given name.
+ * Subclasses may use argument <code>name</code> as file name,
+ * resource name etc.
+ * @param name the name
+ * @return the pmf instance
+ */
+ protected abstract PersistenceManagerFactory getPMF(String name);
+
+ /** */
+ protected void jdoFatalUserException(String assertionMessage) {
+ try {
+ pmf = getPMF(nameDoesNotExist);
+ fail(assertionMessage);
+ } catch (JDOFatalUserException e) {
+ // expected exception
+ if (debug)
+ logger.debug("caught expected exception " + e.toString());
+ }
+ }
+
+ /** */
+ protected void success() {
+ pmf = getPMF(nameExists);
+ makePersistent();
+ }
+}
Property changes on:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AbstractGetPMF.java
___________________________________________________________________
Name: svn:executable
+ *
Index:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByJNDILocation.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByJNDILocation.java
(revision 0)
+++
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByJNDILocation.java
(revision 0)
@@ -0,0 +1,108 @@
+/*
+ * 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.io.File;
+import java.util.Hashtable;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManagerFactory;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>GetPMFByJNDILocation of PersistenceManagerFactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A8.6-19.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * Uses the parameter(s) passed as arguments to construct a Properties
+ * instance, and then delegates to the static method
+ * getPersistenceManagerFactory in the class named in the property
+ * javax.jdo.PersistenceManagerFactoryClass.
+ * If there are any exceptions while trying to construct the Properties
+ * instance or to call the static method,
+ * then either A8.6-4 [JDOFatalUserException] or
+ * A8.6-5 [JDOFatalInternalException is thrown],
+ * depending on whether the exception is due to the user
+ * or the implementation.
+ * The nested exception indicates the cause of the exception.
+ *
+ * @author Michael Watzek
+ */
+
+public class GetPMFByJNDILocation extends AbstractGetPMF {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A8.6-19 (GetPMFByJNDILocation) 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(GetPMFByJNDILocation.class);
+ }
+
+ /**
+ * @see AbstractGetPMF#getPMF(String)
+ */
+ protected PersistenceManagerFactory getPMF(String name) {
+ Hashtable env = new Hashtable();
+ env.put(Context.INITIAL_CONTEXT_FACTORY,
+ "com.sun.jndi.fscontext.RefFSContextFactory");
+
+ Context context = null;
+ try {
+ context = new InitialContext(env);
+ if (name.equals(nameExists)) {
+ PersistenceManagerFactory pmf =
+ JDOHelper.getPersistenceManagerFactory(new File(name));
+ context.bind(jndiName, pmf);
+ }
+ return JDOHelper.getPersistenceManagerFactory(jndiName, context);
+ } catch (NamingException e) {
+ throw new RuntimeException("", e);
+ } finally {
+ if (context != null) {
+ try {
+ context.unbind(jndiName);
+ context.close();
+ } catch (NamingException e) {
+ // stay quiet
+ }
+ }
+ }
+ }
+
+ /** */
+ public void testJDOFatalUserException() {
+ jdoFatalUserException(ASSERTION_FAILED);
+ }
+
+ /** */
+ public void testSuccess() {
+ success();
+ }
+}
Property changes on:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByJNDILocation.java
___________________________________________________________________
Name: svn:executable
+ *
Index:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByJNDILocationAndClassLoader.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByJNDILocationAndClassLoader.java
(revision 0)
+++
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByJNDILocationAndClassLoader.java
(revision 0)
@@ -0,0 +1,109 @@
+/*
+ * 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.io.File;
+import java.util.Hashtable;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManagerFactory;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>GetPMFByJNDILocationAndClassLoader of PersistenceManagerFactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A8.6-20.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * Uses the parameter(s) passed as arguments to construct a Properties
+ * instance, and then delegates to the static method
+ * getPersistenceManagerFactory in the class named in the property
+ * javax.jdo.PersistenceManagerFactoryClass.
+ * If there are any exceptions while trying to construct the Properties
+ * instance or to call the static method,
+ * then either A8.6-4 [JDOFatalUserException] or
+ * A8.6-5 [JDOFatalInternalException is thrown],
+ * depending on whether the exception is due to the user
+ * or the implementation.
+ * The nested exception indicates the cause of the exception.
+ *
+ * @author Michael Watzek
+ */
+
+public class GetPMFByJNDILocationAndClassLoader extends AbstractGetPMF {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A8.6-20 (GetPMFByJNDILocationAndClassLoader) 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(GetPMFByJNDILocationAndClassLoader.class);
+ }
+
+ /**
+ * @see AbstractGetPMF#getPMF(String)
+ */
+ protected PersistenceManagerFactory getPMF(String name) {
+ Hashtable env = new Hashtable();
+ env.put(Context.INITIAL_CONTEXT_FACTORY,
+ "com.sun.jndi.fscontext.RefFSContextFactory");
+
+ Context context = null;
+ try {
+ context = new InitialContext(env);
+ if (name.equals(nameExists)) {
+ PersistenceManagerFactory pmf =
+ JDOHelper.getPersistenceManagerFactory(new File(name));
+ context.bind(jndiName, pmf);
+ }
+ return JDOHelper.getPersistenceManagerFactory(jndiName, context,
+ getClass().getClassLoader());
+ } catch (NamingException e) {
+ throw new RuntimeException("", e);
+ } finally {
+ if (context != null) {
+ try {
+ context.unbind(jndiName);
+ context.close();
+ } catch (NamingException e) {
+ // stay quiet
+ }
+ }
+ }
+ }
+
+ /** */
+ public void testJDOFatalUserException() {
+ jdoFatalUserException(ASSERTION_FAILED);
+ }
+
+ /** */
+ public void testSuccess() {
+ success();
+ }
+}
Property changes on:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByJNDILocationAndClassLoader.java
___________________________________________________________________
Name: svn:executable
+ *
Index:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByFile.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByFile.java
(revision 0)
+++
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByFile.java
(revision 0)
@@ -0,0 +1,80 @@
+/*
+ * 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.io.File;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>GetPMFByFile of PersistenceManagerFactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A8.6-13.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * Uses the parameter(s) passed as arguments to construct a Properties
+ * instance, and then delegates to the static method
+ * getPersistenceManagerFactory in the class named in the property
+ * javax.jdo.PersistenceManagerFactoryClass.
+ * If there are any exceptions while trying to construct the Properties
+ * instance or to call the static method,
+ * then either A8.6-4 [JDOFatalUserException] or
+ * A8.6-5 [JDOFatalInternalException is thrown],
+ * depending on whether the exception is due to the user
+ * or the implementation.
+ * The nested exception indicates the cause of the exception.
+ *
+ * @author Michael Watzek
+ */
+
+public class GetPMFByFile extends AbstractGetPMF {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A8.6-13 (GetPMFByFile) 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(GetPMFByFile.class);
+ }
+
+ /**
+ * @see AbstractGetPMF#getPMF(String)
+ */
+ protected PersistenceManagerFactory getPMF(String name) {
+ return JDOHelper.getPersistenceManagerFactory(new File(name));
+ }
+
+ /** */
+ public void testJDOFatalUserException() {
+ jdoFatalUserException(ASSERTION_FAILED);
+ }
+
+ /** */
+ public void testSuccess() {
+ success();
+ }
+}
Property changes on:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByFile.java
___________________________________________________________________
Name: svn:executable
+ *
Index:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByFileAndClassLoader.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByFileAndClassLoader.java
(revision 0)
+++
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByFileAndClassLoader.java
(revision 0)
@@ -0,0 +1,86 @@
+/*
+ * 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.io.File;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>GetPMFByFileAndClassLoader of PersistenceManagerFactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A8.6-14.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * Uses the parameter(s) passed as arguments to construct a Properties
+ * instance, and then delegates to the static method
+ * getPersistenceManagerFactory in the class named in the property
+ * javax.jdo.PersistenceManagerFactoryClass.
+ * If there are any exceptions while trying to construct the Properties
+ * instance or to call the static method,
+ * then either A8.6-4 [JDOFatalUserException] or
+ * A8.6-5 [JDOFatalInternalException is thrown],
+ * depending on whether the exception is due to the user
+ * or the implementation.
+ * The nested exception indicates the cause of the exception.
+ *
+ * @author Michael Watzek
+ */
+
+public class GetPMFByFileAndClassLoader extends AbstractGetPMF {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A8.6-14 (GetPMFByFileAndClassLoader) failed: ";
+
+ private static final String propertiesFileDoesNotExist =
+ "FileDoesNotExist.properties";
+ private static final String propertiesFileExists =
+ System.getProperty("PMFProperties");
+
+ /**
+ * 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(GetPMFByFileAndClassLoader.class);
+ }
+
+ /**
+ * @see AbstractGetPMF#getPMF(String)
+ */
+ protected PersistenceManagerFactory getPMF(String name) {
+ return JDOHelper.getPersistenceManagerFactory(new File(name),
+ getClass().getClassLoader());
+ }
+
+ /** */
+ public void testJDOFatalUserException() {
+ jdoFatalUserException(ASSERTION_FAILED);
+ }
+
+ /** */
+ public void testSuccess() {
+ success();
+ }
+}
Property changes on:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByFileAndClassLoader.java
___________________________________________________________________
Name: svn:executable
+ *
Index:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByResourceAndClassLoader.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByResourceAndClassLoader.java
(revision 0)
+++
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByResourceAndClassLoader.java
(revision 0)
@@ -0,0 +1,79 @@
+/*
+ * 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 javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>GetPMFByResourceAndClassLoader of PersistenceManagerFactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A8.6-16.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * Uses the parameter(s) passed as arguments to construct a Properties
+ * instance, and then delegates to the static method
+ * getPersistenceManagerFactory in the class named in the property
+ * javax.jdo.PersistenceManagerFactoryClass.
+ * If there are any exceptions while trying to construct the Properties
+ * instance or to call the static method,
+ * then either A8.6-4 [JDOFatalUserException] or
+ * A8.6-5 [JDOFatalInternalException is thrown],
+ * depending on whether the exception is due to the user
+ * or the implementation.
+ * The nested exception indicates the cause of the exception.
+ *
+ * @author Michael Watzek
+ */
+
+public class GetPMFByResourceAndClassLoader extends AbstractGetPMF {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A8.6-16 (GetPMFByResourceAndClassLoader) 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(GetPMFByResourceAndClassLoader.class);
+ }
+
+ /**
+ * @see AbstractGetPMF#getPMF(String)
+ */
+ protected PersistenceManagerFactory getPMF(String name) {
+ return JDOHelper.getPersistenceManagerFactory(removePathPrefix(name),
+ getClass().getClassLoader());
+ }
+
+ /** */
+ public void testJDOFatalUserException() {
+ jdoFatalUserException(ASSERTION_FAILED);
+ }
+
+ /** */
+ public void testSuccess() {
+ success();
+ }
+}
Property changes on:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByResourceAndClassLoader.java
___________________________________________________________________
Name: svn:executable
+ *
Index:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByResource.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByResource.java
(revision 0)
+++
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByResource.java
(revision 0)
@@ -0,0 +1,78 @@
+/*
+ * 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 javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>GetPMFByResource of PersistenceManagerFactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A8.6-15.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * Uses the parameter(s) passed as arguments to construct a Properties
+ * instance, and then delegates to the static method
+ * getPersistenceManagerFactory in the class named in the property
+ * javax.jdo.PersistenceManagerFactoryClass.
+ * If there are any exceptions while trying to construct the Properties
+ * instance or to call the static method,
+ * then either A8.6-4 [JDOFatalUserException] or
+ * A8.6-5 [JDOFatalInternalException is thrown],
+ * depending on whether the exception is due to the user
+ * or the implementation.
+ * The nested exception indicates the cause of the exception.
+ *
+ * @author Michael Watzek
+ */
+
+public class GetPMFByResource extends AbstractGetPMF {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A8.6-15 (GetPMFByResource) 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(GetPMFByResource.class);
+ }
+
+ /**
+ * @see AbstractGetPMF#getPMF(String)
+ */
+ protected PersistenceManagerFactory getPMF(String name) {
+ return JDOHelper.getPersistenceManagerFactory(removePathPrefix(name));
+ }
+
+ /** */
+ public void testJDOFatalUserException() {
+ jdoFatalUserException(ASSERTION_FAILED);
+ }
+
+ /** */
+ public void testSuccess() {
+ success();
+ }
+}
Property changes on:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByResource.java
___________________________________________________________________
Name: svn:executable
+ *
Index:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByStream.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByStream.java
(revision 0)
+++
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByStream.java
(revision 0)
@@ -0,0 +1,96 @@
+/*
+ * 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.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>GetPMFByStream of PersistenceManagerFactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A8.6-17.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * Uses the parameter(s) passed as arguments to construct a Properties
+ * instance, and then delegates to the static method
+ * getPersistenceManagerFactory in the class named in the property
+ * javax.jdo.PersistenceManagerFactoryClass.
+ * If there are any exceptions while trying to construct the Properties
+ * instance or to call the static method,
+ * then either A8.6-4 [JDOFatalUserException] or
+ * A8.6-5 [JDOFatalInternalException is thrown],
+ * depending on whether the exception is due to the user
+ * or the implementation.
+ * The nested exception indicates the cause of the exception.
+ *
+ * @author Michael Watzek
+ */
+
+public class GetPMFByStream extends AbstractGetPMF {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A8.6-17 (GetPMFByStream) 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(GetPMFByStream.class);
+ }
+
+ /**
+ * @see AbstractGetPMF#getPMF(String)
+ */
+ protected PersistenceManagerFactory getPMF(String name) {
+ FileInputStream stream = null;
+ try {
+ stream = new FileInputStream(name);
+ return JDOHelper.getPersistenceManagerFactory(stream);
+ } catch (FileNotFoundException e) {
+ throw new RuntimeException("", e);
+ } finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ /** */
+ public void testJDOFatalUserException() {
+ jdoFatalUserException(ASSERTION_FAILED);
+ }
+
+ /** */
+ public void testSuccess() {
+ success();
+ }
+}
Property changes on:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByStream.java
___________________________________________________________________
Name: svn:executable
+ *
Index:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByStreamAndClassLoader.java
===================================================================
---
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByStreamAndClassLoader.java
(revision 0)
+++
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByStreamAndClassLoader.java
(revision 0)
@@ -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.api.persistencemanagerfactory;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>GetPMFByStreamAndClassLoader of PersistenceManagerFactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A8.6-18.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * Uses the parameter(s) passed as arguments to construct a Properties
+ * instance, and then delegates to the static method
+ * getPersistenceManagerFactory in the class named in the property
+ * javax.jdo.PersistenceManagerFactoryClass.
+ * If there are any exceptions while trying to construct the Properties
+ * instance or to call the static method,
+ * then either A8.6-4 [JDOFatalUserException] or
+ * A8.6-5 [JDOFatalInternalException is thrown],
+ * depending on whether the exception is due to the user
+ * or the implementation.
+ * The nested exception indicates the cause of the exception.
+ *
+ * @author Michael Watzek
+ */
+
+public class GetPMFByStreamAndClassLoader extends AbstractGetPMF {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A8.6-18 (GetPMFByStreamAndClassLoader) 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(GetPMFByStreamAndClassLoader.class);
+ }
+
+ /**
+ * @see AbstractGetPMF#getPMF(String)
+ */
+ protected PersistenceManagerFactory getPMF(String name) {
+ FileInputStream stream = null;
+ try {
+ stream = new FileInputStream(name);
+ return JDOHelper.getPersistenceManagerFactory(stream,
+ getClass().getClassLoader());
+ } catch (FileNotFoundException e) {
+ throw new RuntimeException("", e);
+ } finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+ }
+
+ /** */
+ public void testJDOFatalUserException() {
+ jdoFatalUserException(ASSERTION_FAILED);
+ }
+
+ /** */
+ public void testSuccess() {
+ success();
+ }
+}
Property changes on:
test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPMFByStreamAndClassLoader.java
___________________________________________________________________
Name: svn:executable
+ *