Skip to content

Commit

Permalink
HHH-7028 Fixing annotation based tests (refactoring of sources)
Browse files Browse the repository at this point in the history
  • Loading branch information
hferentschik committed Feb 7, 2012
1 parent b27462f commit 14c0339
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 20 deletions.
Expand Up @@ -32,9 +32,9 @@
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;

Expand Down Expand Up @@ -72,7 +72,7 @@ public void testAddingNonExistingPackageName() {
@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 );
Expand All @@ -81,7 +81,7 @@ public void testAddingPackageName() {
@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 );
Expand Down
Expand Up @@ -39,7 +39,7 @@
* @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)
Expand Down
Expand Up @@ -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() );
Expand All @@ -51,7 +51,7 @@ public void testSimpleOrmVersion2() {
@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() );
Expand All @@ -61,7 +61,7 @@ public void testSimpleOrmVersion1() {
@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();
}
}
Expand Down
Expand Up @@ -56,7 +56,5 @@ public void basicEntityListenerMockTest() {
assertHasAnnotation( index, PseudoJpaDotNames.DEFAULT_ENTITY_LISTENERS );
assertHasAnnotation( index, PseudoJpaDotNames.DEFAULT_PRE_PERSIST );
assertHasAnnotation( index, PseudoJpaDotNames.DEFAULT_POST_PERSIST );


}
}
Expand Up @@ -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>
Expand Down
Expand Up @@ -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>
Expand Up @@ -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>
Expand Down
Expand Up @@ -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>
Expand Down
Expand Up @@ -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">
Expand Down
Expand Up @@ -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>
Expand Down
Expand Up @@ -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>
Expand Down
Expand Up @@ -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">
Expand Down
Expand Up @@ -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">
Expand Down

0 comments on commit 14c0339

Please sign in to comment.