Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/PersistenceDescriptorParserTest.java URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/PersistenceDescriptorParserTest.java?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/PersistenceDescriptorParserTest.java (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/PersistenceDescriptorParserTest.java Tue Apr 25 06:43:00 2006 @@ -0,0 +1,207 @@ +package org.objectstyle.cayenne.jpa.spi; + +import java.io.InputStream; +import java.net.URL; +import java.util.Collection; +import java.util.Iterator; + +import javax.persistence.spi.PersistenceUnitTransactionType; + +import junit.framework.TestCase; + +import org.objectstyle.cayenne.jpa.conf.PersistenceDescriptorParser; +import org.xml.sax.InputSource; +import org.xml.sax.SAXParseException; + +public class PersistenceDescriptorParserTest extends TestCase { + + public void testSample1() throws Exception { + PersistenceDescriptorParser parser = new PersistenceDescriptorParser(); + + URL root = new URL("file:///xyz"); + InputStream in = Thread + .currentThread() + .getContextClassLoader() + .getResourceAsStream("xml-samples/persistence1.xml"); + Collection units = parser.getPersistenceUnits(new InputSource(in), root); + + assertEquals(1, units.size()); + + JpaPersistenceUnitInfo info = (JpaPersistenceUnitInfo) units.iterator().next(); + + assertEquals("OrderManagement", info.getPersistenceUnitName()); + + // JTA is the default when type is ommitted + assertEquals(PersistenceUnitTransactionType.JTA, info.getTransactionType()); + assertEquals(root, info.getPersistenceUnitRootUrl()); + assertTrue(info.getDescription().startsWith("This unit manages orders")); + assertEquals("jdbc/MyOrderDB", info.getProperties().getProperty( + JpaPersistenceProvider.JTA_DATA_SOURCE_PROPERTY)); + + assertEquals(1, info.getMappingFileNames().size()); + assertTrue(info.getMappingFileNames().contains("ormap.xml")); + + assertEquals(2, info.getManagedClassNames().size()); + assertTrue(info.getManagedClassNames().contains("com.widgets.Order")); + assertTrue(info.getManagedClassNames().contains("com.widgets.Customer")); + } + + public void testSampleSchemaHeadersValidating() throws Exception { + PersistenceDescriptorParser parser = new PersistenceDescriptorParser(true); + + URL root = new URL("file:///xyz"); + InputStream in = Thread + .currentThread() + .getContextClassLoader() + .getResourceAsStream("xml-samples/persistence-schema-headers.xml"); + Collection units = parser.getPersistenceUnits(new InputSource(in), root); + + assertEquals(1, units.size()); + + JpaPersistenceUnitInfo info = (JpaPersistenceUnitInfo) units.iterator().next(); + + assertEquals("OrderManagement", info.getPersistenceUnitName()); + + // JTA is the default when type is ommitted + assertEquals(PersistenceUnitTransactionType.JTA, info.getTransactionType()); + assertEquals(root, info.getPersistenceUnitRootUrl()); + assertTrue(info.getDescription().startsWith("This unit manages orders")); + assertEquals("jdbc/MyOrderDB", info.getProperties().getProperty( + JpaPersistenceProvider.JTA_DATA_SOURCE_PROPERTY)); + + assertEquals(1, info.getMappingFileNames().size()); + assertTrue(info.getMappingFileNames().contains("ormap.xml")); + + assertEquals(2, info.getManagedClassNames().size()); + assertTrue(info.getManagedClassNames().contains("com.widgets.Order")); + assertTrue(info.getManagedClassNames().contains("com.widgets.Customer")); + } + + public void testSample2() throws Exception { + PersistenceDescriptorParser parser = new PersistenceDescriptorParser(); + + URL root = new URL("file:///xyz"); + InputStream in = Thread + .currentThread() + .getContextClassLoader() + .getResourceAsStream("xml-samples/persistence2.xml"); + Collection units = parser.getPersistenceUnits(new InputSource(in), root); + + assertEquals(3, units.size()); + + Iterator it = units.iterator(); + for (int i = 1; i <= 3; i++) { + JpaPersistenceUnitInfo info = (JpaPersistenceUnitInfo) it.next(); + + assertEquals("Unit" + i, info.getPersistenceUnitName()); + assertEquals(root, info.getPersistenceUnitRootUrl()); + assertNull(info.getDescription()); + assertTrue(info.getProperties().isEmpty()); + + assertEquals(0, info.getMappingFileNames().size()); + assertEquals(0, info.getManagedClassNames().size()); + } + } + + public void testSample3() throws Exception { + PersistenceDescriptorParser parser = new PersistenceDescriptorParser(); + + URL root = new URL("file:///xyz"); + InputStream in = Thread + .currentThread() + .getContextClassLoader() + .getResourceAsStream("xml-samples/persistence3.xml"); + Collection units = parser.getPersistenceUnits(new InputSource(in), root); + + assertEquals(1, units.size()); + + JpaPersistenceUnitInfo info = (JpaPersistenceUnitInfo) units.iterator().next(); + + assertEquals("OrderManagement4", info.getPersistenceUnitName()); + assertEquals(PersistenceUnitTransactionType.RESOURCE_LOCAL, info + .getTransactionType()); + assertEquals(root, info.getPersistenceUnitRootUrl()); + assertEquals("jdbc/MyDB", info.getProperties().getProperty( + JpaPersistenceProvider.NON_JTA_DATA_SOURCE_PROPERTY)); + + assertEquals(1, info.getMappingFileNames().size()); + assertTrue(info.getMappingFileNames().contains("order-mappings.xml")); + + assertEquals(3, info.getManagedClassNames().size()); + assertTrue(info.getManagedClassNames().contains("com.acme.Order")); + assertTrue(info.getManagedClassNames().contains("com.acme.Customer")); + assertTrue(info.getManagedClassNames().contains("com.acme.Item")); + + assertTrue(info.excludeUnlistedClasses()); + } + + public void testSampleSchemaHeaders() throws Exception { + PersistenceDescriptorParser parser = new PersistenceDescriptorParser(); + + URL root = new URL("file:///xyz"); + InputStream in = Thread + .currentThread() + .getContextClassLoader() + .getResourceAsStream("xml-samples/persistence-schema-headers.xml"); + Collection units = parser.getPersistenceUnits(new InputSource(in), root); + + assertEquals(1, units.size()); + + JpaPersistenceUnitInfo info = (JpaPersistenceUnitInfo) units.iterator().next(); + + assertEquals("OrderManagement", info.getPersistenceUnitName()); + + // JTA is the default when type is ommitted + assertEquals(PersistenceUnitTransactionType.JTA, info.getTransactionType()); + assertEquals(root, info.getPersistenceUnitRootUrl()); + assertTrue(info.getDescription().startsWith("This unit manages orders")); + assertEquals("jdbc/MyOrderDB", info.getProperties().getProperty( + JpaPersistenceProvider.JTA_DATA_SOURCE_PROPERTY)); + + assertEquals(1, info.getMappingFileNames().size()); + assertTrue(info.getMappingFileNames().contains("ormap.xml")); + + assertEquals(2, info.getManagedClassNames().size()); + assertTrue(info.getManagedClassNames().contains("com.widgets.Order")); + assertTrue(info.getManagedClassNames().contains("com.widgets.Customer")); + } + + public void testInvalidSample1() throws Exception { + PersistenceDescriptorParser parser = new PersistenceDescriptorParser(true); + + URL root = new URL("file:///xyz"); + InputStream in = Thread + .currentThread() + .getContextClassLoader() + .getResourceAsStream("xml-samples/persistence-invalid1.xml"); + + try { + parser.getPersistenceUnits(new InputSource(in), root); + fail("Validation did not detect errors"); + } + catch (SAXParseException e) { + // expected + assertTrue(e.getMessage().indexOf("invalidtag") > 0); + } + } + + public void testInvalidSample2() throws Exception { + PersistenceDescriptorParser parser = new PersistenceDescriptorParser(true); + + URL root = new URL("file:///xyz"); + InputStream in = Thread + .currentThread() + .getContextClassLoader() + .getResourceAsStream("xml-samples/persistence-invalid2.xml"); + + try { + parser.getPersistenceUnits(new InputSource(in), root); + fail("Validation did not detect errors"); + } + catch (SAXParseException e) { + // expected + assertTrue(e.getMessage().indexOf("persistence-unit") > 0); + } + } + +}
Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TestManagedClass.java URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TestManagedClass.java?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TestManagedClass.java (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TestManagedClass.java Tue Apr 25 06:43:00 2006 @@ -0,0 +1,6 @@ +package org.objectstyle.cayenne.jpa.spi; + + +public class TestManagedClass { + +} Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TestPersistenceProvider1.java URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TestPersistenceProvider1.java?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TestPersistenceProvider1.java (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TestPersistenceProvider1.java Tue Apr 25 06:43:00 2006 @@ -0,0 +1,11 @@ +package org.objectstyle.cayenne.jpa.spi; + + +public class TestPersistenceProvider1 extends MockPersistenceProvider { + + public static final String UNIT_NAME = "u1"; + + public TestPersistenceProvider1() { + super(UNIT_NAME); + } +} Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TestPersistenceProvider2.java URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TestPersistenceProvider2.java?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TestPersistenceProvider2.java (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TestPersistenceProvider2.java Tue Apr 25 06:43:00 2006 @@ -0,0 +1,11 @@ +package org.objectstyle.cayenne.jpa.spi; + + +public class TestPersistenceProvider2 extends MockPersistenceProvider { + + public static final String UNIT_NAME = "u2"; + + public TestPersistenceProvider2() { + super(UNIT_NAME); + } +} Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TransformingClassLoaderTest.java URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TransformingClassLoaderTest.java?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TransformingClassLoaderTest.java (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/jpa/spi/TransformingClassLoaderTest.java Tue Apr 25 06:43:00 2006 @@ -0,0 +1,94 @@ +package org.objectstyle.cayenne.jpa.spi; + +import junit.framework.TestCase; + +public class TransformingClassLoaderTest extends TestCase { + + public void testFindClass() throws Exception { + + String managedClassName = "org.objectstyle.cayenne.jpa.spi.TestManagedClass"; + JpaPersistenceUnitInfo info = new JpaPersistenceUnitInfo(); + info.addManagedClassName(managedClassName); + + MockClassTransformer t1 = new MockClassTransformer(); + MockClassTransformer t2 = new MockClassTransformer(); + + info.addTransformer(t1); + info.addTransformer(t2); + + ClassLoader parentClassLoader = Thread.currentThread().getContextClassLoader(); + TransformingClassLoader classLoader = new TransformingClassLoader( + info, + parentClassLoader); + + Class objectClass = classLoader.findClass("java.lang.Object"); + assertNotNull(objectClass); + assertSame(Object.class, objectClass); + assertTrue(t1.getTransformed().isEmpty()); + assertTrue(t2.getTransformed().isEmpty()); + + Class testClass = classLoader.findClass(managedClassName); + assertNotNull(testClass); + assertEquals(managedClassName, testClass.getName()); + assertTrue(t1.getTransformed().contains(managedClassName)); + assertTrue(t2.getTransformed().contains(managedClassName)); + } + + public void testLoadClass() throws Exception { + String managedClassName = "org.objectstyle.cayenne.jpa.spi.TestManagedClass"; + JpaPersistenceUnitInfo info = new JpaPersistenceUnitInfo(); + info.addManagedClassName(managedClassName); + + MockClassTransformer t1 = new MockClassTransformer(); + MockClassTransformer t2 = new MockClassTransformer(); + + info.addTransformer(t1); + info.addTransformer(t2); + + ClassLoader parentClassLoader = Thread.currentThread().getContextClassLoader(); + TransformingClassLoader classLoader = new TransformingClassLoader( + info, + parentClassLoader); + + Class objectClass = classLoader.loadClass("java.lang.Object"); + assertNotNull(objectClass); + assertSame(Object.class, objectClass); + assertTrue(t1.getTransformed().isEmpty()); + assertTrue(t2.getTransformed().isEmpty()); + + Class testClass = classLoader.loadClass(managedClassName); + assertNotNull(testClass); + assertEquals(managedClassName, testClass.getName()); + assertTrue(t1.getTransformed().contains(managedClassName)); + assertTrue(t2.getTransformed().contains(managedClassName)); + } + + public void testClassForName() throws Exception { + String managedClassName = "org.objectstyle.cayenne.jpa.spi.TestManagedClass"; + JpaPersistenceUnitInfo info = new JpaPersistenceUnitInfo(); + info.addManagedClassName(managedClassName); + + MockClassTransformer t1 = new MockClassTransformer(); + MockClassTransformer t2 = new MockClassTransformer(); + + info.addTransformer(t1); + info.addTransformer(t2); + + ClassLoader parentClassLoader = Thread.currentThread().getContextClassLoader(); + TransformingClassLoader classLoader = new TransformingClassLoader( + info, + parentClassLoader); + + Class objectClass = Class.forName("java.lang.Object", true, classLoader); + assertNotNull(objectClass); + assertSame(Object.class, objectClass); + assertTrue(t1.getTransformed().isEmpty()); + assertTrue(t2.getTransformed().isEmpty()); + + Class testClass = Class.forName(managedClassName, true, classLoader); + assertNotNull(testClass); + assertEquals(managedClassName, testClass.getName()); + assertTrue(t1.getTransformed().contains(managedClassName)); + assertTrue(t2.getTransformed().contains(managedClassName)); + } +} Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/util/BaseTreeVisitorTest.java URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/util/BaseTreeVisitorTest.java?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/util/BaseTreeVisitorTest.java (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/util/BaseTreeVisitorTest.java Tue Apr 25 06:43:00 2006 @@ -0,0 +1,73 @@ +/* ==================================================================== + * + * The ObjectStyle Group Software License, version 1.1 + * ObjectStyle Group - http://objectstyle.org/ + * + * Copyright (c) 2002-2005, Andrei (Andrus) Adamchik and individual authors + * of the software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if any, + * must include the following acknowlegement: + * "This product includes software developed by independent contributors + * and hosted on ObjectStyle Group web site (http://objectstyle.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "ObjectStyle Group" and "Cayenne" must not be used to endorse + * or promote products derived from this software without prior written + * permission. For written permission, email + * "andrus at objectstyle dot org". + * + * 5. Products derived from this software may not be called "ObjectStyle" + * or "Cayenne", nor may "ObjectStyle" or "Cayenne" appear in their + * names without prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE OBJECTSTYLE GROUP OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals and hosted on ObjectStyle Group web site. For more + * information on the ObjectStyle Group, please see + * <http://objectstyle.org/>. + */ +package org.objectstyle.cayenne.util; + +import junit.framework.TestCase; + +import org.objectstyle.cayenne.project.ProjectPath; + +public class BaseTreeVisitorTest extends TestCase { + + public void testChildVisitor() { + BaseTreeVisitor visitor = new BaseTreeVisitor(); + assertSame(visitor, visitor.childVisitor(new ProjectPath(), String.class)); + + MockHierarchicalTreeVisitor stringVisitor = new MockHierarchicalTreeVisitor(); + visitor.addChildVisitor(String.class, stringVisitor); + + assertSame(stringVisitor, visitor.childVisitor(new ProjectPath(), String.class)); + } +} Added: incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/util/MockHierarchicalTreeVisitor.java URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/util/MockHierarchicalTreeVisitor.java?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/util/MockHierarchicalTreeVisitor.java (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/java/org/objectstyle/cayenne/util/MockHierarchicalTreeVisitor.java Tue Apr 25 06:43:00 2006 @@ -0,0 +1,72 @@ +/* ==================================================================== + * + * The ObjectStyle Group Software License, version 1.1 + * ObjectStyle Group - http://objectstyle.org/ + * + * Copyright (c) 2002-2005, Andrei (Andrus) Adamchik and individual authors + * of the software. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if any, + * must include the following acknowlegement: + * "This product includes software developed by independent contributors + * and hosted on ObjectStyle Group web site (http://objectstyle.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "ObjectStyle Group" and "Cayenne" must not be used to endorse + * or promote products derived from this software without prior written + * permission. For written permission, email + * "andrus at objectstyle dot org". + * + * 5. Products derived from this software may not be called "ObjectStyle" + * or "Cayenne", nor may "ObjectStyle" or "Cayenne" appear in their + * names without prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE OBJECTSTYLE GROUP OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals and hosted on ObjectStyle Group web site. For more + * information on the ObjectStyle Group, please see + * <http://objectstyle.org/>. + */ +package org.objectstyle.cayenne.util; + +import org.objectstyle.cayenne.project.ProjectPath; + +public class MockHierarchicalTreeVisitor implements HierarchicalTreeVisitor { + + public boolean onStartNode(ProjectPath path) { + return false; + } + + public void onFinishNode(ProjectPath path) { + } + + public HierarchicalTreeVisitor childVisitor(ProjectPath path, Class childType) { + return null; + } +} Added: incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-full.xml Tue Apr 25 06:43:00 2006 @@ -0,0 +1,505 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- an entity mapping that contains all possible XML elements per ORM schema. This mapping may not + make sense from the ORM perspective, and used for XML loader testing only. +--> +<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm + http://java.sun.com/xml/ns/persistence/orm/orm_1_0.xsd" + package="default_package" catalog="default_catalog" schema="default_schema" access="FIELD" flush-mode="COMMIT"> + + <!-- ENTITIES --> + + <!-- no inheritance --> + <entity name="MockEntity1" class="org.objectstyle.cayenne.jpa.entity.MockEntity1" access="PROPERTY"> + + <table name="mock_persistent_1" catalog="catalog1" schema="schema1"> + <unique-constraint> + <column-name>column1</column-name> + <column-name>column2</column-name> + </unique-constraint> + <unique-constraint> + <column-name>column3</column-name> + </unique-constraint> + </table> + + <secondary-table name="secondary1" catalog="catalog1" schema="schema1"> + <primary-key-join-column name="secondary_column1" referenced-column-name="column1" column-definition="count(1)"/> + <primary-key-join-column name="secondary_column2" referenced-column-name="column2"/> + <unique-constraint> + <column-name>column1</column-name> + <column-name>column2</column-name> + </unique-constraint> + </secondary-table> + + <secondary-table name="secondary2"/> + + <id-class>org.objectstyle.cayenne.jpa.entity.MockIdClass</id-class> + + <sequence-generator name="sg-name" sequence-name="seq-name" initial-value="5" allocation-size="10"/> + + <table-generator name="table-generator" table="auto_pk_table" catalog="catalog1" schema="schema1" + pk-column-name="next_id" value-column-name="x" pk-column-value="y" initial-value="4" allocation-size="20"> + <unique-constraint> + <column-name>pk1</column-name> + </unique-constraint> + </table-generator> + + <named-query name="query1" query="select x"> + <hint name="hint1" value="value1"/> + <hint name="hint2" value="value2"/> + </named-query> + + <named-query name="query2" query="select y"/> + + <named-native-query name="query3" query="select z" result-class="org.objectstyle.cayenne.jpa.entity.MockResultClass" result-set-mapping="rs-mapping1"> + <hint name="hint3" value="value3"/> + <hint name="hint4" value="value4"/> + </named-native-query> + + <named-native-query name="query4" query="select a"/> + + <sql-result-set-mapping name="result-map1"> + <entity-result entity-class="org.objectstyle.cayenne.jpa.entity.MockEntityX" discriminator-column="column1"> + <field-result name="field1" column="column1"/> + <field-result name="field2" column="column2"/> + </entity-result> + <entity-result entity-class="org.objectstyle.cayenne.jpa.entity.MockEntityY" discriminator-column="column2"> + <field-result name="field3" column="column3"/> + <field-result name="field4" column="column4"/> + </entity-result> + <column-result name="column-result1"/> + <column-result name="column-result2"/> + </sql-result-set-mapping> + + <exclude-default-listeners>true</exclude-default-listeners> + <exclude-superclass-listeners>true</exclude-superclass-listeners> + + <entity-listeners> + <entity-listener class="org.objectstyle.cayenne.jpa.entity.MockEntityListener1"> + <pre-persist method-name="prePersist"/> + <post-persist method-name="postPersist"/> + <pre-remove method-name="preRemove"/> + <post-remove method-name="postRemove"/> + <pre-update method-name="preUpdate"/> + <post-update method-name="postUpdate"/> + <post-load method-name="postLoad"/> + </entity-listener> + + <entity-listener class="org.objectstyle.cayenne.jpa.entity.MockEntityListener2"> + <post-persist method-name="postPersist"/> + </entity-listener> + + </entity-listeners> + + <pre-persist method-name="eprePersist"/> + <post-persist method-name="epostPersist"/> + <pre-remove method-name="epreRemove"/> + <post-remove method-name="epostRemove"/> + <pre-update method-name="epreUpdate"/> + <post-update method-name="epostUpdate"/> + <post-load method-name="epostLoad"/> + + <id name="id1"> + <column name="id_column" unique="true" nullable="true" insertable="true" updatable="true" + table="id_table" length="3" precision="4" scale="5"/> + <generated-value strategy="SEQUENCE" generator="id-generator"/> + <temporal>TIME</temporal> + </id> + </entity> + + <!-- JOINED inheritance --> + <entity name="MockEntity2" class="org.objectstyle.cayenne.jpa.entity.MockEntity2"> + <primary-key-join-column name="pk_column1" referenced-column-name="super_column1" column-definition="count(1)"/> + <primary-key-join-column name="pk_column2"/> + <inheritance strategy="JOINED"/> + + <attribute-override name="attribute1"> + <column name="ao_column1" unique="true" nullable="true" insertable="true" updatable="true" + column-definition="count(1)" table="ao_table1" length="3" precision="4" scale="5"/> + </attribute-override> + + <attribute-override name="attribute2"> + <column name="ao_column2" unique="true" nullable="true" insertable="true" updatable="true" + column-definition="count(1)" table="ao_table1" length="3" precision="4" scale="5"/> + </attribute-override> + </entity> + + <!-- SINGLE_TABLE inheritance --> + <entity name="MockEntity3" class="org.objectstyle.cayenne.jpa.entity.MockEntity3"> + <inheritance strategy="SINGLE_TABLE"/> + <discriminator-value>DV</discriminator-value> + <discriminator-column name="column1" discriminator-type="CHAR" column-definition="count(1)" length="5"/> + </entity> + + <!-- EMBEDDED Id --> + <entity name="MockEntity4" class="org.objectstyle.cayenne.jpa.entity.MockEntity4"> + <embedded-id name="embeddedId"> + <attribute-override name="attribute1"> + <column name="ao_column1"/> + </attribute-override> + <attribute-override name="attribute2"> + <column name="ao_column2"/> + </attribute-override> + </embedded-id> + </entity> + + <!-- Entity with Attributes --> + <entity name="MockEntity5" class="org.objectstyle.cayenne.jpa.entity.MockEntity5"> + <!-- basic attribute --> + <attribute name="attribute1"> + <basic fetch="EAGER" optional="true"/> + </attribute> + + <!-- version attribute --> + <attribute name="attribute2"> + <version/> + </attribute> + + <!-- one-to-one attribute --> + <attribute name="attribute3"> + <one-to-one target-entity="org.objectstyle.cayenne.jpa.entity.MockTargetEntity1" + fetch="LAZY" optional="true" mapped-by="mb1"> + <cascade>MERGE</cascade> + <cascade>PERSIST</cascade> + </one-to-one> + </attribute> + + <!-- one-to-many attribute --> + <attribute name="attribute4"> + <one-to-many target-entity="org.objectstyle.cayenne.jpa.entity.MockTargetEntity2" fetch="LAZY" mapped-by="mb2"> + <cascade>MERGE</cascade> + <cascade>PERSIST</cascade> + </one-to-many> + </attribute> + + <!-- many-to-one attribute --> + <attribute name="attribute5"> + <many-to-one target-entity="org.objectstyle.cayenne.jpa.entity.MockTargetEntity1" fetch="LAZY" optional="true"> + <cascade>MERGE</cascade> + <cascade>PERSIST</cascade> + </many-to-one> + </attribute> + + <!-- many-to-many attribute --> + <attribute name="attribute6"> + <many-to-many target-entity="org.objectstyle.cayenne.jpa.entity.MockTargetEntity1" fetch="LAZY" mapped-by="mb4"> + <cascade>MERGE</cascade> + <cascade>PERSIST</cascade> + </many-to-many> + </attribute> + + <!-- embedded attribute --> + <attribute name="attribute7"> + <embedded>true</embedded> + </attribute> + + <!-- transient attribute --> + <attribute name="attribute8"> + <transient>true</transient> + </attribute> + + <!-- column attribute --> + <attribute name="attribute9"> + <column name="column9"/> + </attribute> + + <!-- join-column attribute --> + <attribute name="attribute10"> + <join-column name="join-column-10" referenced-column-name="x-ref" unique="true" nullable="true" + insertable="true" updatable="true" column-definition="x-def" table="jt1"/> + </attribute> + + <!-- join-table attribute --> + <attribute name="attribute11"> + <join-table name="jtable1" catalog="catalog1" schema="schema1"> + <join-column name="join_column1"/> + <join-column name="join_column2"/> + <inverse-join-column name="ijoin_column1"/> + <inverse-join-column name="ijoin_column2"/> + <unique-constraint> + <column-name>pk1</column-name> + </unique-constraint> + </join-table> + </attribute> + + <!-- lob attribute --> + <attribute name="attribute12"> + <lob/> + </attribute> + + <!-- temporal attribute --> + <attribute name="attribute13"> + <temporal>DATE</temporal> + </attribute> + + <!-- enumerated attribute --> + <attribute name="attribute14"> + <enumerated>ORDINAL</enumerated> + </attribute> + + <!-- map-key attribute --> + <attribute name="attribute15"> + <map-key name="mk"/> + </attribute> + + <!-- order-by attribute --> + <attribute name="attribute16"> + <order-by>x ASC</order-by> + </attribute> + + <!-- attribute override --> + <attribute name="attribute17"> + <attribute-override name="attribute1"> + <column name="ao_column1"/> + </attribute-override> + <attribute-override name="attribute2"> + <column name="ao_column2"/> + </attribute-override> + </attribute> + </entity> + + <!-- EMBEDDABLES --> + + <embeddable class="org.objectstyle.cayenne.jpa.entity.MockEmbed1" access="FIELD"> + <embeddable-attribute name="ea1"> + <basic fetch="EAGER" optional="true"/> + <lob/> + <temporal>DATE</temporal> + <enumerated>ORDINAL</enumerated> + <column name="column9"/> + </embeddable-attribute> + + <embeddable-attribute name="ea2"/> + </embeddable> + + <embeddable class="org.objectstyle.cayenne.jpa.entity.MockEmbded2"/> + + <!-- MAPPED SUPERCLASSES --> + <mapped-superclass class="org.objectstyle.cayenne.jpa.entity.MockMappedSuperclass1" access="FIELD"> + <id-class>org.objectstyle.cayenne.jpa.entity.MockIdClass</id-class> + + <exclude-default-listeners>true</exclude-default-listeners> + <exclude-superclass-listeners>true</exclude-superclass-listeners> + + <entity-listener class="org.objectstyle.cayenne.jpa.entity.MockEntityListener1"> + <pre-persist method-name="prePersist"/> + <post-persist method-name="postPersist"/> + <pre-remove method-name="preRemove"/> + <post-remove method-name="postRemove"/> + <pre-update method-name="preUpdate"/> + <post-update method-name="postUpdate"/> + <post-load method-name="postLoad"/> + </entity-listener> + + <pre-persist method-name="eprePersist"/> + <post-persist method-name="epostPersist"/> + <pre-remove method-name="epreRemove"/> + <post-remove method-name="epostRemove"/> + <pre-update method-name="epreUpdate"/> + <post-update method-name="epostUpdate"/> + <post-load method-name="epostLoad"/> + + <id name="id1"> + <column name="id_column" unique="true" nullable="true" insertable="true" updatable="true" + table="id_table" length="3" precision="4" scale="5"/> + <generated-value strategy="SEQUENCE" generator="id-generator"/> + <temporal>TIME</temporal> + </id> + </mapped-superclass> + + <!-- EMBEDDED Id --> + <mapped-superclass class="org.objectstyle.cayenne.jpa.entity.MockMappedSuperclass2"> + <embedded-id name="embeddedId"> + <attribute-override name="attribute1"> + <column name="ao_column1"/> + </attribute-override> + <attribute-override name="attribute2"> + <column name="ao_column2"/> + </attribute-override> + </embedded-id> + </mapped-superclass> + + <!-- Mapped Superclass w/Attributes --> + <mapped-superclass class="org.objectstyle.cayenne.jpa.entity.MockMappedSuperclass3"> + <!-- basic attribute --> + <attribute name="attribute1"> + <basic fetch="EAGER" optional="true"/> + </attribute> + + <!-- version attribute --> + <attribute name="attribute2"> + <version/> + </attribute> + + <!-- one-to-one attribute --> + <attribute name="attribute3"> + <one-to-one target-entity="org.objectstyle.cayenne.jpa.entity.MockTargetEntity1" + fetch="LAZY" optional="true" mapped-by="mb1"> + <cascade>MERGE</cascade> + <cascade>PERSIST</cascade> + </one-to-one> + </attribute> + + <!-- one-to-many attribute --> + <attribute name="attribute4"> + <one-to-many target-entity="org.objectstyle.cayenne.jpa.entity.MockTargetEntity2" fetch="LAZY" mapped-by="mb2"> + <cascade>MERGE</cascade> + <cascade>PERSIST</cascade> + </one-to-many> + </attribute> + + <!-- many-to-one attribute --> + <attribute name="attribute5"> + <many-to-one target-entity="org.objectstyle.cayenne.jpa.entity.MockTargetEntity1" fetch="LAZY" optional="true"> + <cascade>MERGE</cascade> + <cascade>PERSIST</cascade> + </many-to-one> + </attribute> + + <!-- many-to-many attribute --> + <attribute name="attribute6"> + <many-to-many target-entity="org.objectstyle.cayenne.jpa.entity.MockTargetEntity1" fetch="LAZY" mapped-by="mb4"> + <cascade>MERGE</cascade> + <cascade>PERSIST</cascade> + </many-to-many> + </attribute> + + <!-- embedded attribute --> + <attribute name="attribute7"> + <embedded>true</embedded> + </attribute> + + <!-- transient attribute --> + <attribute name="attribute8"> + <transient>true</transient> + </attribute> + + <!-- column attribute --> + <attribute name="attribute9"> + <column name="column9"/> + </attribute> + + <!-- join-column attribute --> + <attribute name="attribute10"> + <join-column name="join-column-10" referenced-column-name="x-ref" unique="true" nullable="true" + insertable="true" updatable="true" column-definition="x-def" table="jt1"/> + </attribute> + + <!-- join-table attribute --> + <attribute name="attribute11"> + <join-table name="jtable1" catalog="catalog1" schema="schema1"> + <join-column name="join_column1"/> + <join-column name="join_column2"/> + <inverse-join-column name="ijoin_column1"/> + <inverse-join-column name="ijoin_column2"/> + <unique-constraint> + <column-name>pk1</column-name> + </unique-constraint> + </join-table> + </attribute> + + <!-- lob attribute --> + <attribute name="attribute12"> + <lob/> + </attribute> + + <!-- temporal attribute --> + <attribute name="attribute13"> + <temporal>DATE</temporal> + </attribute> + + <!-- enumerated attribute --> + <attribute name="attribute14"> + <enumerated>ORDINAL</enumerated> + </attribute> + + <!-- map-key attribute --> + <attribute name="attribute15"> + <map-key name="mk"/> + </attribute> + + <!-- order-by attribute --> + <attribute name="attribute16"> + <order-by>x ASC</order-by> + </attribute> + + <!-- attribute override --> + <attribute name="attribute17"> + <attribute-override name="attribute1"> + <column name="ao_column1"/> + </attribute-override> + <attribute-override name="attribute2"> + <column name="ao_column2"/> + </attribute-override> + </attribute> + </mapped-superclass> + + <!-- NAMED QUERIES --> + <named-query name="query1" query="select x"> + <hint name="hint1" value="value1"/> + <hint name="hint2" value="value2"/> + </named-query> + + <named-query name="query2" query="select y"/> + + <!-- NAMED NATIVE QUERIES --> + <named-native-query name="query3" query="select z" result-class="org.objectstyle.cayenne.jpa.entity.MockResultClass" result-set-mapping="rs-mapping1"> + <hint name="hint3" value="value3"/> + <hint name="hint4" value="value4"/> + </named-native-query> + + <named-native-query name="query4" query="select a"/> + + <!-- SQL RESULT SET MAPPINGS --> + <sql-result-set-mapping name="result-map1"> + <entity-result entity-class="org.objectstyle.cayenne.jpa.entity.MockEntityX" discriminator-column="column1"> + <field-result name="field1" column="column1"/> + <field-result name="field2" column="column2"/> + </entity-result> + <entity-result entity-class="org.objectstyle.cayenne.jpa.entity.MockEntityY" discriminator-column="column2"> + <field-result name="field3" column="column3"/> + <field-result name="field4" column="column4"/> + </entity-result> + <column-result name="column-result1"/> + <column-result name="column-result2"/> + </sql-result-set-mapping> + + <sql-result-set-mapping name="result-map2"/> + + <!-- SEQUENCE GENERATORS --> + <sequence-generator name="sg-name" sequence-name="seq-name" initial-value="5" allocation-size="10"/> + <sequence-generator name="sg-name2"/> + + <!-- TABLE GENERATORS --> + <table-generator name="table-generator" table="auto_pk_table" catalog="catalog1" schema="schema1" + pk-column-name="next_id" value-column-name="x" pk-column-value="y" initial-value="4" allocation-size="20"> + <unique-constraint> + <column-name>pk1</column-name> + </unique-constraint> + </table-generator> + <table-generator name="table-generator2"/> + + <!-- DEFAULT ENTITY LISTENERS --> + <default-entity-listeners> + <entity-listener class="org.objectstyle.cayenne.jpa.entity.MockEntityListener1"> + <pre-persist method-name="prePersist"/> + <post-persist method-name="postPersist"/> + <pre-remove method-name="preRemove"/> + <post-remove method-name="postRemove"/> + <pre-update method-name="preUpdate"/> + <post-update method-name="postUpdate"/> + <post-load method-name="postLoad"/> + </entity-listener> + + <entity-listener class="org.objectstyle.cayenne.jpa.entity.MockEntityListener2"> + <post-persist method-name="postPersist"/> + </entity-listener> + </default-entity-listeners> + + <!-- CASCADES --> + <cascade>MERGE</cascade> + <cascade>PERSIST</cascade> + <cascade>REFRESH</cascade> + +</entity-mappings> \ No newline at end of file Added: incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-invalid1.xml URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-invalid1.xml?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-invalid1.xml (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers-invalid1.xml Tue Apr 25 06:43:00 2006 @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm + http://java.sun.com/xml/ns/persistence/orm/orm_1_0.xsd"> + + <bad-tag/> +</entity-mappings> \ No newline at end of file Added: incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers.xml URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers.xml?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers.xml (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/orm-schema-headers.xml Tue Apr 25 06:43:00 2006 @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm + http://java.sun.com/xml/ns/persistence/orm/orm_1_0.xsd"> + + <entity class="org.objectstyle.cayenne.jpa.persistent.MockPersistent2"/> +</entity-mappings> \ No newline at end of file Added: incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence-invalid1.xml URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence-invalid1.xml?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence-invalid1.xml (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence-invalid1.xml Tue Apr 25 06:43:00 2006 @@ -0,0 +1,14 @@ +<persistence xmlns="http://java.sun.com/xml/ns/persistence" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence + http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> + + <invalidtag/> + <persistence-unit name="OrderManagement"> + + <mapping-file>ormap.xml</mapping-file> + <jar-file>MyOrderApp.jar</jar-file> + <class>com.widgets.Order</class> + <class>com.widgets.Customer</class> + </persistence-unit> +</persistence> \ No newline at end of file Added: incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence-invalid2.xml URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence-invalid2.xml?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence-invalid2.xml (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence-invalid2.xml Tue Apr 25 06:43:00 2006 @@ -0,0 +1,14 @@ +<persistence xmlns="http://java.sun.com/xml/ns/persistence" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence + http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> + + <persistence-unit name="OrderManagement"> + <mapping-file>ormap.xml</mapping-file> + <jar-file>MyOrderApp.jar</jar-file> + <class>com.widgets.Order</class> + <class>com.widgets.Customer</class> + + <persistence-unit name="unit-in-wrong-place"/> + </persistence-unit> +</persistence> \ No newline at end of file Added: incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence-schema-headers.xml URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence-schema-headers.xml?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence-schema-headers.xml (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence-schema-headers.xml Tue Apr 25 06:43:00 2006 @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<persistence xmlns="http://java.sun.com/xml/ns/persistence" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/persistence + http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> + <persistence-unit name="OrderManagement"> + <description>This unit manages orders and customers. It does not rely on any + vendor-specific features and can therefore be deployed to any persistence + provider. + </description> + <jta-data-source>jdbc/MyOrderDB</jta-data-source> + <mapping-file>ormap.xml</mapping-file> + <jar-file>MyOrderApp.jar</jar-file> + <class>com.widgets.Order</class> + <class>com.widgets.Customer</class> + </persistence-unit> +</persistence> \ No newline at end of file Added: incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence1.xml URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence1.xml?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence1.xml (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence1.xml Tue Apr 25 06:43:00 2006 @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<persistence> + <persistence-unit name="OrderManagement"> + <description>This unit manages orders and customers. It does not rely on any + vendor-specific features and can therefore be deployed to any persistence + provider. + </description> + <jta-data-source>jdbc/MyOrderDB</jta-data-source> + <mapping-file>ormap.xml</mapping-file> + <jar-file>MyOrderApp.jar</jar-file> + <class>com.widgets.Order</class> + <class>com.widgets.Customer</class> + </persistence-unit> +</persistence> \ No newline at end of file Added: incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence2.xml URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence2.xml?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence2.xml (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence2.xml Tue Apr 25 06:43:00 2006 @@ -0,0 +1,5 @@ +<persistence> + <persistence-unit name="Unit1"/> + <persistence-unit name="Unit2"/> + <persistence-unit name="Unit3"/> +</persistence> Added: incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence3.xml URL: http://svn.apache.org/viewcvs/incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence3.xml?rev=396882&view=auto ============================================================================== --- incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence3.xml (added) +++ incubator/cayenne/trunk/cayenne-jpa/src/test/resources/xml-samples/persistence3.xml Tue Apr 25 06:43:00 2006 @@ -0,0 +1,10 @@ +<persistence> + <persistence-unit name="OrderManagement4" transaction-type="RESOURCE_LOCAL"> + <non-jta-data-source>jdbc/MyDB</non-jta-data-source> + <mapping-file>order-mappings.xml</mapping-file> + <exclude-unlisted-classes/> + <class>com.acme.Order</class> + <class>com.acme.Customer</class> + <class>com.acme.Item</class> + </persistence-unit> +</persistence> \ No newline at end of file
