mirror of https://github.com/apache/openjpa.git
OPENJPA-1272 Test was not cleaning up after itself properly. This was causing failures on some build configurations.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@809671 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f214d9f397
commit
f13af4a400
|
@ -54,19 +54,42 @@ public class TestAssocOverridesXML extends AbstractPersistenceTestCase{
|
||||||
"embed-persistence.xml", props);
|
"embed-persistence.xml", props);
|
||||||
|
|
||||||
EntityManager em = emf1.createEntityManager();
|
EntityManager em = emf1.createEntityManager();
|
||||||
|
|
||||||
|
XMLAssocOverEntityA ea = new XMLAssocOverEntityA();
|
||||||
|
XMLAssocOverEntityB eb = new XMLAssocOverEntityB();
|
||||||
|
XMLAssocOverEntityB meb = new XMLAssocOverEntityB();
|
||||||
|
XMLAssocOverEmbed emb = new XMLAssocOverEmbed();
|
||||||
|
eb.setName("XMLAssocOverEntityB");
|
||||||
|
meb.setName("XMLAssocOverEntityBM21");
|
||||||
|
List<XMLAssocOverEntityA> eaList1 = new ArrayList<XMLAssocOverEntityA>();
|
||||||
|
eaList1.add(ea);
|
||||||
|
List<XMLAssocOverEntityA> eaList2 = new ArrayList<XMLAssocOverEntityA>();
|
||||||
|
eaList2.add(ea);
|
||||||
|
eb.setEaList(eaList1);
|
||||||
|
meb.setEaList(eaList2);
|
||||||
|
emb.setName("XMLAssocOverEmbed");
|
||||||
|
emb.setEb(eb);
|
||||||
|
emb.setMeb(meb);
|
||||||
|
List<XMLAssocOverEmbed> embList = new ArrayList<XMLAssocOverEmbed>();
|
||||||
|
embList.add(emb);
|
||||||
|
ea.setEmbA(embList);
|
||||||
|
|
||||||
em.getTransaction().begin();
|
em.getTransaction().begin();
|
||||||
|
em.persist(ea);
|
||||||
em.getTransaction().commit();
|
em.getTransaction().commit();
|
||||||
em.close();
|
em.close();
|
||||||
// The above should trigger schema definition
|
try {
|
||||||
|
assertSQLFragnments(_sql, "CREATE TABLE XML_EMBALIST .*" +
|
||||||
assertSQLFragnments(_sql, "CREATE TABLE XML_EMBALIST .*" +
|
|
||||||
" .*emba_entb.*emba_mentb");
|
" .*emba_entb.*emba_mentb");
|
||||||
|
|
||||||
try {
|
}
|
||||||
if (emf1 != null)
|
finally {
|
||||||
cleanupEMF(emf1);
|
try {
|
||||||
} catch (Exception e) {
|
if (emf1 != null)
|
||||||
fail(e.getMessage());
|
cleanupEMF(emf1);
|
||||||
|
} catch (Exception e) {
|
||||||
|
fail(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
<mapping-file>org/apache/openjpa/persistence/jdbc/order/order-orm-3.xml</mapping-file>
|
<mapping-file>org/apache/openjpa/persistence/jdbc/order/order-orm-3.xml</mapping-file>
|
||||||
<mapping-file>org/apache/openjpa/persistence/inheritance/orm.xml</mapping-file>
|
<mapping-file>org/apache/openjpa/persistence/inheritance/orm.xml</mapping-file>
|
||||||
<mapping-file>org/apache/openjpa/persistence/orm.xml</mapping-file>
|
<mapping-file>org/apache/openjpa/persistence/orm.xml</mapping-file>
|
||||||
|
<mapping-file>org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml</mapping-file>
|
||||||
<properties>
|
<properties>
|
||||||
<property name="openjpa.jdbc.SynchronizeMappings"
|
<property name="openjpa.jdbc.SynchronizeMappings"
|
||||||
value="buildSchema(ForeignKeys=true)"/>
|
value="buildSchema(ForeignKeys=true)"/>
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?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.
|
||||||
|
-->
|
||||||
|
<!-- AtestCatalog metadata in xml -->
|
||||||
|
<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 orm_2_0.xsd"
|
||||||
|
version="2.0">
|
||||||
|
|
||||||
|
<entity class="org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEntityA">
|
||||||
|
<attributes>
|
||||||
|
<id name="id">
|
||||||
|
<generated-value/>
|
||||||
|
</id>
|
||||||
|
<element-collection name="embaList">
|
||||||
|
<association-override name="eb">
|
||||||
|
<join-column name="emba_entb" />
|
||||||
|
</association-override>
|
||||||
|
<association-override name="meb">
|
||||||
|
<join-column name="emba_mentb" />
|
||||||
|
</association-override>
|
||||||
|
<collection-table name="XML_EMBALIST"/>
|
||||||
|
</element-collection>
|
||||||
|
</attributes>
|
||||||
|
</entity>
|
||||||
|
|
||||||
|
<entity class="org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEntityB">
|
||||||
|
<attributes>
|
||||||
|
<id name="id">
|
||||||
|
<generated-value/>
|
||||||
|
</id>
|
||||||
|
<basic name="name"/>
|
||||||
|
<one-to-many name="eaList">
|
||||||
|
<cascade>
|
||||||
|
<cascade-all />
|
||||||
|
</cascade>
|
||||||
|
</one-to-many>
|
||||||
|
</attributes>
|
||||||
|
</entity>
|
||||||
|
|
||||||
|
<embeddable class="org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEmbed">
|
||||||
|
<attributes>
|
||||||
|
<basic name="name"/>
|
||||||
|
<many-to-one name="meb">
|
||||||
|
<cascade>
|
||||||
|
<cascade-all />
|
||||||
|
</cascade>
|
||||||
|
</many-to-one>
|
||||||
|
<one-to-one name="eb">
|
||||||
|
<cascade>
|
||||||
|
<cascade-all />
|
||||||
|
</cascade>
|
||||||
|
</one-to-one>
|
||||||
|
</attributes>
|
||||||
|
</embeddable>
|
||||||
|
</entity-mappings>
|
|
@ -216,36 +216,6 @@ version="2.0">
|
||||||
</attributes>
|
</attributes>
|
||||||
</entity>
|
</entity>
|
||||||
|
|
||||||
<entity class="org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEntityA">
|
|
||||||
<attributes>
|
|
||||||
<id name="id">
|
|
||||||
<generated-value/>
|
|
||||||
</id>
|
|
||||||
<element-collection name="embaList">
|
|
||||||
<association-override name="eb">
|
|
||||||
<join-column name="emba_entb" />
|
|
||||||
</association-override>
|
|
||||||
<association-override name="meb">
|
|
||||||
<join-column name="emba_mentb" />
|
|
||||||
</association-override>
|
|
||||||
<collection-table name="XML_EMBALIST"/>
|
|
||||||
</element-collection>
|
|
||||||
</attributes>
|
|
||||||
</entity>
|
|
||||||
|
|
||||||
<entity class="org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEntityB">
|
|
||||||
<attributes>
|
|
||||||
<id name="id">
|
|
||||||
<generated-value/>
|
|
||||||
</id>
|
|
||||||
<basic name="name"/>
|
|
||||||
<one-to-many name="eaList">
|
|
||||||
<cascade>
|
|
||||||
<cascade-all />
|
|
||||||
</cascade>
|
|
||||||
</one-to-many>
|
|
||||||
</attributes>
|
|
||||||
</entity>
|
|
||||||
<embeddable
|
<embeddable
|
||||||
class="org.apache.openjpa.persistence.embed.attrOverrides.AddressXml"
|
class="org.apache.openjpa.persistence.embed.attrOverrides.AddressXml"
|
||||||
access="FIELD">
|
access="FIELD">
|
||||||
|
@ -304,20 +274,4 @@ version="2.0">
|
||||||
</basic>
|
</basic>
|
||||||
</attributes>
|
</attributes>
|
||||||
</embeddable>
|
</embeddable>
|
||||||
|
|
||||||
<embeddable class="org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEmbed">
|
|
||||||
<attributes>
|
|
||||||
<basic name="name"/>
|
|
||||||
<many-to-one name="meb">
|
|
||||||
<cascade>
|
|
||||||
<cascade-all />
|
|
||||||
</cascade>
|
|
||||||
</many-to-one>
|
|
||||||
<one-to-one name="eb">
|
|
||||||
<cascade>
|
|
||||||
<cascade-all />
|
|
||||||
</cascade>
|
|
||||||
</one-to-one>
|
|
||||||
</attributes>
|
|
||||||
</embeddable>
|
|
||||||
</entity-mappings>
|
</entity-mappings>
|
|
@ -21,12 +21,12 @@
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
version="2.0">
|
version="2.0">
|
||||||
<persistence-unit name="AssocOverPU">
|
<persistence-unit name="AssocOverPU">
|
||||||
<mapping-file>org/apache/openjpa/persistence/embed/embed-orm.xml</mapping-file>
|
<mapping-file>org/apache/openjpa/persistence/embed/embed-assoc-over-orm.xml</mapping-file>
|
||||||
<class>org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEmbed</class>
|
<class>org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEmbed</class>
|
||||||
<class>org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEntityA</class>
|
<class>org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEntityA</class>
|
||||||
<class>org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEntityB</class>
|
<class>org.apache.openjpa.persistence.embed.attrOverrides.XMLAssocOverEntityB</class>
|
||||||
<properties>
|
<properties>
|
||||||
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
|
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(SchemaAction='drop,add')"/>
|
||||||
</properties>
|
</properties>
|
||||||
</persistence-unit>
|
</persistence-unit>
|
||||||
</persistence>
|
</persistence>
|
||||||
|
|
Loading…
Reference in New Issue