HHH-7028 Fixing annotation based tests (refactoring of sources)
This commit is contained in:
parent
b27462fe5f
commit
14c0339fdd
|
@ -32,9 +32,9 @@ import org.hibernate.SessionFactory;
|
|||
import org.hibernate.metamodel.Metadata;
|
||||
import org.hibernate.metamodel.MetadataSources;
|
||||
import org.hibernate.metamodel.SessionFactoryBuilder;
|
||||
import org.hibernate.metamodel.spi.binding.FetchProfile;
|
||||
import org.hibernate.metamodel.internal.MetadataImpl;
|
||||
import org.hibernate.metamodel.internal.SessionFactoryBuilderImpl;
|
||||
import org.hibernate.metamodel.spi.binding.FetchProfile;
|
||||
import org.hibernate.service.ServiceRegistryBuilder;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class MetadataImplTest extends BaseUnitTestCase {
|
|||
@Test
|
||||
public void testAddingPackageName() {
|
||||
MetadataSources sources = new MetadataSources( new ServiceRegistryBuilder().buildServiceRegistry() );
|
||||
sources.addPackage( "org.hibernate.metamodel.source.internal" );
|
||||
sources.addPackage( MetadataImplTest.class.getPackage().getName() );
|
||||
MetadataImpl metadata = (MetadataImpl) sources.buildMetadata();
|
||||
|
||||
assertFetchProfile( metadata );
|
||||
|
@ -81,7 +81,7 @@ public class MetadataImplTest extends BaseUnitTestCase {
|
|||
@Test
|
||||
public void testAddingPackageNameWithTrailingDot() {
|
||||
MetadataSources sources = new MetadataSources( new ServiceRegistryBuilder().buildServiceRegistry() );
|
||||
sources.addPackage( "org.hibernate.metamodel.source.internal." );
|
||||
sources.addPackage( MetadataImplTest.class.getPackage().getName() + "." );
|
||||
MetadataImpl metadata = (MetadataImpl) sources.buildMetadata();
|
||||
|
||||
assertFetchProfile( metadata );
|
||||
|
|
|
@ -39,7 +39,7 @@ import static org.junit.Assert.assertEquals;
|
|||
* @author Strong Liu
|
||||
*/
|
||||
public class QuotedIdentifierTest extends BaseAnnotationBindingTestCase {
|
||||
private final String ormPath = "org/hibernate/metamodel/source/annotations/xml/orm-quote-identifier.xml";
|
||||
private final String ormPath = "org/hibernate/metamodel/internal/source/annotations/xml/orm-quote-identifier.xml";
|
||||
|
||||
@Test
|
||||
@Resources(annotatedClasses = { Item.class, Item2.class, Item3.class, Item4.class }, ormXmlPath = ormPath)
|
||||
|
|
|
@ -41,7 +41,7 @@ public class OrmXmlParserTests extends BaseUnitTestCase {
|
|||
@Test
|
||||
public void testSimpleOrmVersion2() {
|
||||
MetadataSources sources = new MetadataSources( new ServiceRegistryBuilder().buildServiceRegistry() );
|
||||
sources.addResource( "org/hibernate/metamodel/source/annotations/xml/orm-father.xml" );
|
||||
sources.addResource( "org/hibernate/metamodel/internal/source/annotations/xml/orm-father.xml" );
|
||||
MetadataImpl metadata = (MetadataImpl) sources.buildMetadata();
|
||||
|
||||
EntityBinding binding = metadata.getEntityBinding( Father.class.getName() );
|
||||
|
@ -51,7 +51,7 @@ public class OrmXmlParserTests extends BaseUnitTestCase {
|
|||
@Test
|
||||
public void testSimpleOrmVersion1() {
|
||||
MetadataSources sources = new MetadataSources( new ServiceRegistryBuilder().buildServiceRegistry() );
|
||||
sources.addResource( "org/hibernate/metamodel/source/annotations/xml/orm-star.xml" );
|
||||
sources.addResource( "org/hibernate/metamodel/internal/source/annotations/xml/orm-star.xml" );
|
||||
MetadataImpl metadata = (MetadataImpl) sources.buildMetadata();
|
||||
|
||||
EntityBinding binding = metadata.getEntityBinding( Star.class.getName() );
|
||||
|
@ -61,7 +61,7 @@ public class OrmXmlParserTests extends BaseUnitTestCase {
|
|||
@Test(expected = MappingException.class)
|
||||
public void testInvalidOrmXmlThrowsException() {
|
||||
MetadataSources sources = new MetadataSources( new ServiceRegistryBuilder().buildServiceRegistry() );
|
||||
sources.addResource( "org/hibernate/metamodel/source/annotations/xml/orm-invalid.xml" );
|
||||
sources.addResource( "org/hibernate/metamodel/internal/source/annotations/xml/orm-invalid.xml" );
|
||||
sources.buildMetadata();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,5 @@ public class EntityListenerTest extends AbstractMockerTest {
|
|||
assertHasAnnotation( index, PseudoJpaDotNames.DEFAULT_ENTITY_LISTENERS );
|
||||
assertHasAnnotation( index, PseudoJpaDotNames.DEFAULT_PRE_PERSIST );
|
||||
assertHasAnnotation( index, PseudoJpaDotNames.DEFAULT_POST_PERSIST );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<cascade-persist/>
|
||||
</persistence-unit-defaults>
|
||||
</persistence-unit-metadata>
|
||||
<package>org.hibernate.metamodel.source.annotations.xml.mocker</package>
|
||||
<package>org.hibernate.metamodel.internal.source.annotations.xml.mocker</package>
|
||||
|
||||
<entity class="Book">
|
||||
<attributes>
|
|
@ -3,7 +3,7 @@
|
|||
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
version="2.0">
|
||||
<package>org.hibernate.metamodel.source.annotations.xml.mocker</package>
|
||||
<package>org.hibernate.metamodel.internal.source.annotations.xml.mocker</package>
|
||||
<schema>XML_SCHEMA</schema>
|
||||
<catalog>XML_CATALOG</catalog>
|
||||
</entity-mappings>
|
|
@ -3,7 +3,7 @@
|
|||
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
version="2.0">
|
||||
<package>org.hibernate.metamodel.source.annotations.xml.mocker</package>
|
||||
<package>org.hibernate.metamodel.internal.source.annotations.xml.mocker</package>
|
||||
<entity class="Author" metadata-complete="true">
|
||||
<id-class class="Topic"/>
|
||||
</entity>
|
|
@ -8,17 +8,17 @@
|
|||
<delimited-identifiers/>
|
||||
<access>FIELD</access>
|
||||
<entity-listeners>
|
||||
<entity-listener class="org.hibernate.metamodel.source.annotations.xml.mocker.ItemListener">
|
||||
<entity-listener class="org.hibernate.metamodel.internal.source.annotations.xml.mocker.ItemListener">
|
||||
<pre-persist method-name="prePersist"/>
|
||||
<post-persist method-name="postPersist"/>
|
||||
</entity-listener>
|
||||
</entity-listeners>
|
||||
</persistence-unit-defaults>
|
||||
</persistence-unit-metadata>
|
||||
<package>org.hibernate.metamodel.source.annotations.xml.mocker</package>
|
||||
<package>org.hibernate.metamodel.internal.source.annotations.xml.mocker</package>
|
||||
<entity class="Item">
|
||||
<entity-listeners>
|
||||
<entity-listener class="org.hibernate.metamodel.source.annotations.xml.mocker.ItemListener">
|
||||
<entity-listener class="org.hibernate.metamodel.internal.source.annotations.xml.mocker.ItemListener">
|
||||
<pre-persist method-name="prePersist"/>
|
||||
<post-persist method-name="postPersist"/>
|
||||
</entity-listener>
|
|
@ -3,7 +3,7 @@
|
|||
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
version="2.0">
|
||||
<package>org.hibernate.metamodel.source.annotations.xml.mocker</package>
|
||||
<package>org.hibernate.metamodel.internal.source.annotations.xml.mocker</package>
|
||||
<mapped-superclass class="Book">
|
||||
<attributes>
|
||||
<element-collection name="topics">
|
|
@ -8,7 +8,7 @@
|
|||
<delimited-identifiers/>
|
||||
<access>FIELD</access>
|
||||
<entity-listeners>
|
||||
<entity-listener class="org.hibernate.metamodel.source.annotations.xml.mocker.ItemListener">
|
||||
<entity-listener class="org.hibernate.metamodel.internal.source.annotations.xml.mocker.ItemListener">
|
||||
<pre-persist method-name="prePersist"/>
|
||||
<post-persist method-name="postPersist"/>
|
||||
</entity-listener>
|
|
@ -3,7 +3,7 @@
|
|||
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
version="2.0">
|
||||
<package>org.hibernate.metamodel.source.annotations.xml</package>
|
||||
<package>org.hibernate.metamodel.internal.source.annotations.xml</package>
|
||||
|
||||
<entity class="Father">
|
||||
<attributes>
|
|
@ -3,7 +3,7 @@
|
|||
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
version="2.0">
|
||||
<package>org.hibernate.metamodel.source.annotations.xml</package>
|
||||
<package>org.hibernate.metamodel.internal.source.annotations.xml</package>
|
||||
<entity class="Star" access="FIELD" metadata-complete="false" foo="bar">
|
||||
<attributes>
|
||||
<id name="id">
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
version="1.0">
|
||||
<!-- use orm_1_0 on purpose to test backward compatibility -->
|
||||
<package>org.hibernate.metamodel.source.annotations.xml</package>
|
||||
<package>org.hibernate.metamodel.internal.source.annotations.xml</package>
|
||||
<entity class="Star" access="FIELD" metadata-complete="false">
|
||||
<attributes>
|
||||
<id name="id">
|
Loading…
Reference in New Issue