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 2008/02/15 00:13:33 UTC
svn commit: r627905 - in /db/jdo/trunk/tck2: maven.xml
src/conf/iut-persistence.xml src/conf/jdori-persistence.xml
src/conf/runonce.conf
src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Persistence.java
Author: mcaisse
Date: Thu Feb 14 15:13:08 2008
New Revision: 627905
URL: http://svn.apache.org/viewvc?rev=627905&view=rev
Log:
JDO-576 new tests for persistence.xml
Added:
db/jdo/trunk/tck2/src/conf/iut-persistence.xml (with props)
db/jdo/trunk/tck2/src/conf/jdori-persistence.xml (with props)
db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Persistence.java (with props)
Modified:
db/jdo/trunk/tck2/maven.xml
db/jdo/trunk/tck2/src/conf/runonce.conf
Modified: db/jdo/trunk/tck2/maven.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/maven.xml?rev=627905&r1=627904&r2=627905&view=diff
==============================================================================
--- db/jdo/trunk/tck2/maven.xml (original)
+++ db/jdo/trunk/tck2/maven.xml Thu Feb 14 15:13:08 2008
@@ -263,6 +263,7 @@
<goal name="runtck.iut" prereqs="setProps">
<mkdir dir="${jdo.tck.log.directory.database}"/>
<j:set var="jdo.tck.jdoconfig" value="iut-jdoconfig.xml"/>
+ <j:set var="jdo.tck.persistence" value="iut-persistence.xml"/>
<attainGoal name="privateRuntck.iut"/>
</goal>
@@ -311,6 +312,7 @@
<goal name="runtck.jdori" prereqs="setProps">
<mkdir dir="${jdo.tck.log.directory.database}"/>
<j:set var="jdo.tck.jdoconfig" value="jdori-jdoconfig.xml"/>
+ <j:set var="jdo.tck.persistence" value="jdori-persistence.xml"/>
<attainGoal name="privateRuntck.jdori"/>
</goal>
@@ -785,6 +787,8 @@
</copy>
<copy tofile="${jdo.tck.testclasses.dir}/META-INF/jdoconfig.xml"
file="${basedir}/src/conf/${jdo.tck.jdoconfig}"/>
+ <copy tofile="${jdo.tck.testclasses.dir}/META-INF/persistence.xml"
+ file="${basedir}/src/conf/${jdo.tck.persistence}"/>
</goal>
<!-- ==================== -->
Added: db/jdo/trunk/tck2/src/conf/iut-persistence.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/conf/iut-persistence.xml?rev=627905&view=auto
==============================================================================
--- db/jdo/trunk/tck2/src/conf/iut-persistence.xml (added)
+++ db/jdo/trunk/tck2/src/conf/iut-persistence.xml Thu Feb 14 15:13:08 2008
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ version="1.0">
+
+<!--
+ We need to enumerate each persistent class first in the persistence.xml
+ See: http://issues.apache.org/jira/browse/OPENJPA-78
+ -->
+<persistence-unit name="none" transaction-type="RESOURCE_LOCAL">
+ <!--
+ <class>hellojpa.Message</class>
+ <class>relations.Deity</class>
+ -->
+</persistence-unit>
+
+<!--
+ A persistence unit is a set of listed persistent entities as well
+ the configuration of an EntityManagerFactory. We configure each
+ example in a separate persistence-unit.
+ -->
+<persistence-unit name="applicationidentity0" transaction-type="RESOURCE_LOCAL">
+ <!--
+ The default provider can be OpenJPA, or some other product.
+ This element is optional if OpenJPA is the only JPA provider
+ in the current classloading environment, but can be specified
+ in cases where there are multiple JPA implementations available.
+ -->
+
+ <properties>
+ <property name="javax.jdo.option.ConnectionDriverName"
+ value="org.apache.derby.jdbc.EmbeddedDriver"/>
+ <property name="javax.jdo.option.ConnectionURL" value="jdbc:derby:jdotckdb"/>
+ <property name="javax.jdo.option.ConnectionUserName" value="tckuser"/>
+ <property name="javax.jdo.option.ConnectionPassword" value="tckuser"/>
+ <property name="javax.jdo.option.Optimistic" value="false"/>
+ <property name="javax.jdo.option.RestoreValues" value="false"/>
+ <property name="javax.jdo.option.RetainValues" value="false"/>
+ <property name="javax.jdo.option.Mapping" value="derby"/>
+ <property name="javax.jdo.mapping.Schema" value="applicationidentity0"/>
+ <property name="javax.jdo.option.Mapping" value="standard"/>
+ <property name="org.jpox.metadata.validate" value="false"/>
+ <property name="org.jpox.validateTables" value="false"/>
+ <property name="org.jpox.validateConstraints" value="false"/>
+ <property name="org.jpox.autoCreateSchema" value="false"/>
+ <property name="org.jpox.autoCreateTables" value="false"/>
+ <property name="org.jpox.autoCreateConstraints" value="false"/>
+ <property name="org.jpox.autoCreateColumns" value="false"/>
+ <property name="org.jpox.rdbms.CheckExistTablesOrViews" value="false"/>
+ <property name="org.jpox.autoStartMechanism" value="None"/>
+ <property name="org.jpox.connectionPoolingType" value="C3P0"/>
+ <property name="org.jpox.implementationCreatorName" value="asm"/>
+ </properties>
+</persistence-unit>
+
+<!-- persistence unit for the "relations" example -->
+<persistence-unit name="relations" transaction-type="RESOURCE_LOCAL">
+ <class>relations.Deity</class>
+</persistence-unit>
+
+<!-- persistence unit for the "reversemapping" example -->
+<persistence-unit name="reversemapping" transaction-type="RESOURCE_LOCAL">
+ <!--
+ <mapping-file>reversemapping/orm.xml</mapping-file>
+ -->
+</persistence-unit>
+</persistence>
\ No newline at end of file
Propchange: db/jdo/trunk/tck2/src/conf/iut-persistence.xml
------------------------------------------------------------------------------
svn:eol-style = LF
Added: db/jdo/trunk/tck2/src/conf/jdori-persistence.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/conf/jdori-persistence.xml?rev=627905&view=auto
==============================================================================
--- db/jdo/trunk/tck2/src/conf/jdori-persistence.xml (added)
+++ db/jdo/trunk/tck2/src/conf/jdori-persistence.xml Thu Feb 14 15:13:08 2008
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ version="1.0">
+
+<!--
+ We need to enumerate each persistent class first in the persistence.xml
+ See: http://issues.apache.org/jira/browse/OPENJPA-78
+ -->
+<persistence-unit name="none" transaction-type="RESOURCE_LOCAL">
+ <!--
+ <class>hellojpa.Message</class>
+ <class>relations.Deity</class>
+ -->
+</persistence-unit>
+
+<!--
+ A persistence unit is a set of listed persistent entities as well
+ the configuration of an EntityManagerFactory. We configure each
+ example in a separate persistence-unit.
+ -->
+<persistence-unit name="applicationidentity0" transaction-type="RESOURCE_LOCAL">
+ <!--
+ The default provider can be OpenJPA, or some other product.
+ This element is optional if OpenJPA is the only JPA provider
+ in the current classloading environment, but can be specified
+ in cases where there are multiple JPA implementations available.
+ -->
+
+ <properties>
+ <property name="javax.jdo.option.ConnectionDriverName"
+ value="org.apache.derby.jdbc.EmbeddedDriver"/>
+ <property name="javax.jdo.option.ConnectionURL" value="jdbc:derby:jdotckdb"/>
+ <property name="javax.jdo.option.ConnectionUserName" value="tckuser"/>
+ <property name="javax.jdo.option.ConnectionPassword" value="tckuser"/>
+ <property name="javax.jdo.option.Optimistic" value="false"/>
+ <property name="javax.jdo.option.RestoreValues" value="false"/>
+ <property name="javax.jdo.option.RetainValues" value="false"/>
+ <property name="javax.jdo.option.Mapping" value="derby"/>
+ <property name="javax.jdo.mapping.Schema" value="applicationidentity0"/>
+ <property name="javax.jdo.option.Mapping" value="standard"/>
+ <property name="org.jpox.metadata.validate" value="false"/>
+ <property name="org.jpox.validateTables" value="false"/>
+ <property name="org.jpox.validateConstraints" value="false"/>
+ <property name="org.jpox.autoCreateSchema" value="false"/>
+ <property name="org.jpox.autoCreateTables" value="false"/>
+ <property name="org.jpox.autoCreateConstraints" value="false"/>
+ <property name="org.jpox.autoCreateColumns" value="false"/>
+ <property name="org.jpox.rdbms.CheckExistTablesOrViews" value="false"/>
+ <property name="org.jpox.autoStartMechanism" value="None"/>
+ <property name="org.jpox.connectionPoolingType" value="C3P0"/>
+ <property name="org.jpox.implementationCreatorName" value="asm"/>
+ </properties>
+</persistence-unit>
+
+<!-- persistence unit for the "relations" example -->
+<persistence-unit name="relations" transaction-type="RESOURCE_LOCAL">
+ <class>relations.Deity</class>
+</persistence-unit>
+
+<!-- persistence unit for the "reversemapping" example -->
+<persistence-unit name="reversemapping" transaction-type="RESOURCE_LOCAL">
+ <!--
+ <mapping-file>reversemapping/orm.xml</mapping-file>
+ -->
+</persistence-unit>
+</persistence>
\ No newline at end of file
Propchange: db/jdo/trunk/tck2/src/conf/jdori-persistence.xml
------------------------------------------------------------------------------
svn:eol-style = LF
Modified: db/jdo/trunk/tck2/src/conf/runonce.conf
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/conf/runonce.conf?rev=627905&r1=627904&r2=627905&view=diff
==============================================================================
--- db/jdo/trunk/tck2/src/conf/runonce.conf (original)
+++ db/jdo/trunk/tck2/src/conf/runonce.conf Thu Feb 14 15:13:08 2008
@@ -22,4 +22,5 @@
runOnce = true
jdo.tck.classes = \
org.apache.jdo.tck.api.SignatureTest \
-org.apache.jdo.tck.api.persistencemanagerfactory.config.Jdoconfig
\ No newline at end of file
+org.apache.jdo.tck.api.persistencemanagerfactory.config.Jdoconfig \
+org.apache.jdo.tck.api.persistencemanagerfactory.config.Persistence
\ No newline at end of file
Added: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Persistence.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Persistence.java?rev=627905&view=auto
==============================================================================
--- db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Persistence.java (added)
+++ db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Persistence.java Thu Feb 14 15:13:08 2008
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.config;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.Transaction;
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>Close of PersistenceManagerFactory
+ *<BR/>
+ *<B>Keywords:</B> persistencemanagerfactory, jdoconfig.xml
+ *<BR/>
+ *<B>Assertion IDs:</B> A8.7-1
+ *<BR/>
+ *<B>Assertion Description: </B>
+ * The application provides a resource named META-INF/persistence.xml and
+ * optionally META-INF/services/javax.persistence.EntityManagerFactory which
+ * contain configuration information
+ */
+public class Persistence extends JDO_Test {
+
+ /** Creates a new instance of Jdoconfig */
+ public Persistence() {
+ }
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A11.1.2-1 failed: ";
+ private static final String ANONYMOUS_PMF_NAME = "";
+ // Do not use superclass pmf, pm
+ private PersistenceManagerFactory pmf = null;
+ private PersistenceManager pm = null;
+
+ /**
+ * 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(Persistence.class);
+ }
+
+ /** */
+ public void testGetPMFfromEMFNamed() {
+ String name = "applicationidentity0";
+ pmf = JDOHelper.getPersistenceManagerFactory(name);
+ assertEquals("Incorrect value for RestoreValues",
+ pmf.getRestoreValues(), false);
+ runTest(name);
+ }
+
+ /** */
+ public void testGetPMFfromEMFNamedSpaces() {
+ String name = "applicationidentity0";
+ pmf = JDOHelper.getPersistenceManagerFactory(" \t" + name + " \n");
+ assertEquals("Incorrect value for RestoreValues",
+ pmf.getRestoreValues(), true);
+ runTest(name);
+ }
+
+ /** */
+ public void runTest(String name) {
+ assertEquals("Incorrect PMF name", pmf.getName(), name);
+
+ // check pmf.isClosed() before and after pmf.close()
+ if (pmf.isClosed()) {
+ fail(ASSERTION_FAILED,
+ "PMF.isClosed() returned true on an open pmf");
+ }
+ makePersistent();
+
+ pmf.close();
+
+ if (!pmf.isClosed()) {
+ fail(ASSERTION_FAILED,
+ "PMF.isClosed() returned false on a closed pmf");
+ }
+ // have next invocation of getPMF() get a new pmf
+ pmf = null;
+ }
+
+ protected void makePersistent() {
+ addTearDownClass(PCPoint.class);
+ pm = pmf.getPersistenceManager();
+ Transaction tx = pm.currentTransaction();
+ tx.begin();
+ PCPoint comp = new PCPoint(1, 2);
+ pm.makePersistent(comp);
+ tx.commit();
+ }
+}
Propchange: db/jdo/trunk/tck2/src/java/org/apache/jdo/tck/api/persistencemanagerfactory/config/Persistence.java
------------------------------------------------------------------------------
svn:eol-style = LF