diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalManyToManys.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalManyToMany.java similarity index 93% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalManyToManys.java rename to hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalManyToMany.java index fe25860d15..0102d6626a 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalManyToManys.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalManyToMany.java @@ -35,17 +35,17 @@ import javax.persistence.OneToMany; * @author Gail Badner */ @Entity -public class EntityWithUnidirectionalManyToManys { +public class EntityWithUnidirectionalManyToMany { private Long id; private String name; private Collection theBag = new ArrayList(); private Set theSet = new HashSet(); private Collection thePropertyRefBag = new ArrayList(); - public EntityWithUnidirectionalManyToManys() { + public EntityWithUnidirectionalManyToMany() { } - public EntityWithUnidirectionalManyToManys(String name) { + public EntityWithUnidirectionalManyToMany(String name) { this.name = name; } diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnidirectionalManyToManyBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnidirectionalManyToManyBindingTests.java index cb5121a2c9..cb4f510a07 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnidirectionalManyToManyBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnidirectionalManyToManyBindingTests.java @@ -23,35 +23,23 @@ */ package org.hibernate.metamodel.spi.binding; -import java.util.Collection; -import java.util.Set; - import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.hibernate.engine.FetchTiming; import org.hibernate.metamodel.MetadataSourceProcessingOrder; import org.hibernate.metamodel.MetadataSources; import org.hibernate.metamodel.internal.MetadataImpl; +import org.hibernate.metamodel.spi.binding.EntityWithUnidirectionalManyToMany; import org.hibernate.metamodel.spi.relational.Column; -import org.hibernate.metamodel.spi.relational.ForeignKey; import org.hibernate.metamodel.spi.relational.Identifier; -import org.hibernate.metamodel.spi.relational.Value; import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.internal.StandardServiceRegistryImpl; import org.hibernate.testing.FailureExpected; import org.hibernate.testing.junit4.BaseUnitTestCase; -import org.hibernate.type.BagType; -import org.hibernate.type.CollectionType; -import org.hibernate.type.SetType; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; /** * @author Gail Badner @@ -86,7 +74,7 @@ public class UnidirectionalManyToManyBindingTests extends BaseUnitTestCase { sources.addResource( "org/hibernate/metamodel/spi/binding/SimpleEntity.hbm.xml" ); MetadataImpl metadata = (MetadataImpl) sources.getMetadataBuilder().with( processingOrder ).buildMetadata(); - final EntityBinding entityBinding = metadata.getEntityBinding( EntityWithUnidirectionalManyToManys.class.getName() ); + final EntityBinding entityBinding = metadata.getEntityBinding( EntityWithUnidirectionalManyToMany.class.getName() ); final EntityBinding simpleEntityBinding = metadata.getEntityBinding( SimpleEntity.class.getName() ); assertNotNull( entityBinding ); diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalOneToManys.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/EntityWithUnidirectionalOneToMany.java similarity index 58% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalOneToManys.java rename to hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/EntityWithUnidirectionalOneToMany.java index 9a97a81f88..539cc2ef4d 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalOneToManys.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/EntityWithUnidirectionalOneToMany.java @@ -1,27 +1,4 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * Copyright (c) 2012, Red Hat Inc. or third-party contributors as - * indicated by the @author tags or express copyright attribution - * statements applied by the authors. All third-party contributions are - * distributed under license by Red Hat Inc. - * - * This copyrighted material is made available to anyone wishing to use, modify, - * copy, or redistribute it subject to the terms and conditions of the GNU - * Lesser General Public License, as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this distribution; if not, write to: - * Free Software Foundation, Inc. - * 51 Franklin Street, Fifth Floor - * Boston, MA 02110-1301 USA - */ -package org.hibernate.metamodel.spi.binding; +package org.hibernate.metamodel.spi.binding.onetomany; import java.util.ArrayList; import java.util.Collection; @@ -34,11 +11,13 @@ import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; +import org.hibernate.metamodel.spi.binding.SimpleEntity; + /** * @author Gail Badner */ @Entity -public class EntityWithUnidirectionalOneToManys { +public class EntityWithUnidirectionalOneToMany { private Long id; private String name; private Collection theBag = new ArrayList(); @@ -47,13 +26,6 @@ public class EntityWithUnidirectionalOneToManys { private Map theMap = new HashMap(); private Collection thePropertyRefBag = new ArrayList(); - public EntityWithUnidirectionalOneToManys() { - } - - public EntityWithUnidirectionalOneToManys(String name) { - this.name = name; - } - @Id public Long getId() { return id; @@ -116,3 +88,5 @@ public class EntityWithUnidirectionalOneToManys { this.thePropertyRefBag = thePropertyRefSet; } } + + diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnidirectionalOneToManyBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/UnidirectionalOneToManyBindingTests.java similarity index 82% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnidirectionalOneToManyBindingTests.java rename to hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/UnidirectionalOneToManyBindingTests.java index 40c4b74d15..bfeb661fc2 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnidirectionalOneToManyBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/UnidirectionalOneToManyBindingTests.java @@ -21,7 +21,7 @@ * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301 USA */ -package org.hibernate.metamodel.spi.binding; +package org.hibernate.metamodel.spi.binding.onetomany; import java.util.Collection; import java.util.List; @@ -29,6 +29,7 @@ import java.util.Map; import java.util.Set; import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -36,6 +37,13 @@ import org.hibernate.engine.FetchTiming; import org.hibernate.metamodel.MetadataSourceProcessingOrder; import org.hibernate.metamodel.MetadataSources; import org.hibernate.metamodel.internal.MetadataImpl; +import org.hibernate.metamodel.spi.binding.EntityBinding; +import org.hibernate.metamodel.spi.binding.HibernateTypeDescriptor; +import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; +import org.hibernate.metamodel.spi.binding.PluralAttributeElementNature; +import org.hibernate.metamodel.spi.binding.PluralAttributeKeyBinding; +import org.hibernate.metamodel.spi.binding.SimpleEntity; +import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; import org.hibernate.metamodel.spi.relational.Column; import org.hibernate.metamodel.spi.relational.ForeignKey; import org.hibernate.metamodel.spi.relational.Identifier; @@ -64,7 +72,7 @@ public class UnidirectionalOneToManyBindingTests extends BaseUnitTestCase { @Before public void setUp() { - serviceRegistry = (StandardServiceRegistryImpl) new ServiceRegistryBuilder().buildServiceRegistry(); + serviceRegistry = ( StandardServiceRegistryImpl ) new ServiceRegistryBuilder().buildServiceRegistry(); } @After @@ -85,22 +93,25 @@ public class UnidirectionalOneToManyBindingTests extends BaseUnitTestCase { private void doTest(MetadataSourceProcessingOrder processingOrder) { MetadataSources sources = new MetadataSources( serviceRegistry ); // sources.addAnnotatedClass( EntityWithBasicCollections.class ); - sources.addResource( "org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalOneToManys.hbm.xml" ); + sources.addResource( "org/hibernate/metamodel/spi/binding/onetomany/EntityWithUnidirectionalOneToMany.hbm.xml" ); sources.addResource( "org/hibernate/metamodel/spi/binding/SimpleEntity.hbm.xml" ); - MetadataImpl metadata = (MetadataImpl) sources.getMetadataBuilder().with( processingOrder ).buildMetadata(); + MetadataImpl metadata = ( MetadataImpl ) sources.getMetadataBuilder().with( processingOrder ).buildMetadata(); - final EntityBinding entityBinding = metadata.getEntityBinding( EntityWithUnidirectionalOneToManys.class.getName() ); + final EntityBinding entityBinding = metadata.getEntityBinding( EntityWithUnidirectionalOneToMany.class.getName() ); final EntityBinding simpleEntityBinding = metadata.getEntityBinding( SimpleEntity.class.getName() ); assertNotNull( entityBinding ); - assertEquals( Identifier.toIdentifier( "SimpleEntity" ), simpleEntityBinding.getPrimaryTable().getLogicalName() ); + assertEquals( + Identifier.toIdentifier( "SimpleEntity" ), + simpleEntityBinding.getPrimaryTable().getLogicalName() + ); assertEquals( 1, simpleEntityBinding.getPrimaryTable().getPrimaryKey().getColumnSpan() ); Column simpleEntityIdColumn = simpleEntityBinding.getPrimaryTable().getPrimaryKey().getColumns().get( 0 ); - assertEquals( Identifier.toIdentifier("id") , simpleEntityIdColumn.getColumnName() ); + assertEquals( Identifier.toIdentifier( "id" ), simpleEntityIdColumn.getColumnName() ); checkResult( entityBinding, - metadata.getCollection( EntityWithUnidirectionalOneToManys.class.getName() + ".theBag" ), + metadata.getCollection( EntityWithUnidirectionalOneToMany.class.getName() + ".theBag" ), BagType.class, Collection.class, simpleEntityBinding, @@ -112,7 +123,7 @@ public class UnidirectionalOneToManyBindingTests extends BaseUnitTestCase { checkResult( entityBinding, - metadata.getCollection( EntityWithUnidirectionalOneToManys.class.getName() + ".theSet" ), + metadata.getCollection( EntityWithUnidirectionalOneToMany.class.getName() + ".theSet" ), SetType.class, Set.class, simpleEntityBinding, @@ -124,7 +135,7 @@ public class UnidirectionalOneToManyBindingTests extends BaseUnitTestCase { checkResult( entityBinding, - metadata.getCollection( EntityWithUnidirectionalOneToManys.class.getName() + ".theList" ), + metadata.getCollection( EntityWithUnidirectionalOneToMany.class.getName() + ".theList" ), ListType.class, List.class, simpleEntityBinding, @@ -136,7 +147,7 @@ public class UnidirectionalOneToManyBindingTests extends BaseUnitTestCase { checkResult( entityBinding, - metadata.getCollection( EntityWithUnidirectionalOneToManys.class.getName() + ".theMap" ), + metadata.getCollection( EntityWithUnidirectionalOneToMany.class.getName() + ".theMap" ), MapType.class, Map.class, simpleEntityBinding, @@ -148,11 +159,11 @@ public class UnidirectionalOneToManyBindingTests extends BaseUnitTestCase { checkResult( entityBinding, - metadata.getCollection( EntityWithUnidirectionalOneToManys.class.getName() + ".thePropertyRefBag" ), + metadata.getCollection( EntityWithUnidirectionalOneToMany.class.getName() + ".thePropertyRefBag" ), BagType.class, Collection.class, simpleEntityBinding, - (SingularAttributeBinding) entityBinding.locateAttributeBinding( "name" ), + ( SingularAttributeBinding ) entityBinding.locateAttributeBinding( "name" ), Identifier.toIdentifier( "ownerName" ), FetchTiming.EXTRA_DELAYED, false @@ -169,12 +180,15 @@ public class UnidirectionalOneToManyBindingTests extends BaseUnitTestCase { Identifier expectedKeySourceColumnName, FetchTiming expectedFetchTiming, boolean expectedNullableCollectionKey) { - assertEquals( + Assert.assertEquals( PluralAttributeElementNature.ONE_TO_MANY, collectionBinding.getPluralAttributeElementBinding().getPluralAttributeElementNature() ); - assertSame( collectionBinding, collectionOwnerBinding.locateAttributeBinding( collectionBinding.getAttribute().getName() ) ); - assertEquals( expectedFetchTiming, collectionBinding.getFetchTiming() ); + assertSame( + collectionBinding, + collectionOwnerBinding.locateAttributeBinding( collectionBinding.getAttribute().getName() ) + ); + assertEquals( expectedFetchTiming, collectionBinding.getFetchTiming() ); assertEquals( expectedFetchTiming != FetchTiming.IMMEDIATE, collectionBinding.isLazy() ); final String role = collectionBinding.getAttribute().getRole(); @@ -213,7 +227,7 @@ public class UnidirectionalOneToManyBindingTests extends BaseUnitTestCase { assertEquals( 1, fk.getTargetColumns().size() ); SingularAttributeBinding keySourceAttributeBinding = - ( SingularAttributeBinding) expectedElementEntityBinding.locateAttributeBinding( + ( SingularAttributeBinding ) expectedElementEntityBinding.locateAttributeBinding( "_" + role + "BackRef" ); assertEquals( expectedNullableCollectionKey, keyBinding.isNullable() ); @@ -224,7 +238,7 @@ public class UnidirectionalOneToManyBindingTests extends BaseUnitTestCase { assertEquals( 1, keySourceAttributeBinding.getRelationalValueBindings().size() ); Value keySourceValue = keySourceAttributeBinding.getRelationalValueBindings().get( 0 ).getValue(); assertTrue( keySourceValue instanceof Column ); - Column keySourceColumn = (Column) keySourceValue; + Column keySourceColumn = ( Column ) keySourceValue; assertEquals( expectedKeySourceColumnName, keySourceColumn.getColumnName() ); assertSame( keySourceColumn, fk.getColumns().get( 0 ) ); assertSame( keySourceColumn, fk.getSourceColumns().get( 0 ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithBasicCollections.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/EntityWithBasicCollections.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithBasicCollections.hbm.xml rename to hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/EntityWithBasicCollections.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithManyToOnes.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/EntityWithManyToOnes.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithManyToOnes.hbm.xml rename to hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/EntityWithManyToOnes.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalManyToManys.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalManyToManys.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalManyToManys.hbm.xml rename to hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalManyToManys.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/SimpleEntity.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/SimpleEntity.hbm.xml similarity index 82% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/SimpleEntity.hbm.xml rename to hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/SimpleEntity.hbm.xml index 89e574ac6c..ee77f942d8 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/SimpleEntity.hbm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/SimpleEntity.hbm.xml @@ -4,11 +4,10 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - - - - + + + - + diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/SimpleEntityWithSimpleComponent.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/SimpleEntityWithSimpleComponent.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/SimpleEntityWithSimpleComponent.hbm.xml rename to hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/SimpleEntityWithSimpleComponent.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/SimpleVersionedEntity.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/SimpleVersionedEntity.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/SimpleVersionedEntity.hbm.xml rename to hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/SimpleVersionedEntity.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/SimpleVersionedEntity.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/SimpleVersionedEntity.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/SimpleVersionedEntity.xml rename to hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/SimpleVersionedEntity.xml diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnsavedDefaultValues.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/UnsavedDefaultValues.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnsavedDefaultValues.hbm.xml rename to hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/UnsavedDefaultValues.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnsavedNonDefaultValues.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/UnsavedNonDefaultValues.hbm.xml similarity index 100% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnsavedNonDefaultValues.hbm.xml rename to hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/UnsavedNonDefaultValues.hbm.xml diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalOneToManys.hbm.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/onetomany/EntityWithUnidirectionalOneToMany.hbm.xml similarity index 66% rename from hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalOneToManys.hbm.xml rename to hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/onetomany/EntityWithUnidirectionalOneToMany.hbm.xml index 0c0f083e16..48ad6f9f42 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithUnidirectionalOneToManys.hbm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/metamodel/spi/binding/onetomany/EntityWithUnidirectionalOneToMany.hbm.xml @@ -1,35 +1,35 @@ - - + - + - + - + - + - +