diff options
author | kmoore | 2008-02-25 16:20:08 +0000 |
---|---|---|
committer | kmoore | 2008-02-25 16:20:08 +0000 |
commit | 799475ec15f7f5d8838fef3d8397d38fde082111 (patch) | |
tree | 45e8be97e6d1f3db423baf767a669e8955790b84 /jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt | |
parent | b7f9a0cb92fdf23807be30cb6ca97b579f7a7a8b (diff) | |
download | webtools.dali-799475ec15f7f5d8838fef3d8397d38fde082111.tar.gz webtools.dali-799475ec15f7f5d8838fef3d8397d38fde082111.tar.xz webtools.dali-799475ec15f7f5d8838fef3d8397d38fde082111.zip |
Refactored packages into public API, renamed interfaces
Diffstat (limited to 'jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt')
125 files changed, 8515 insertions, 8515 deletions
diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/ContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/ContextModelTestCase.java index 3c3e764d35..60c1da4daa 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/ContextModelTestCase.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/ContextModelTestCase.java @@ -17,22 +17,22 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IJpaProject; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.IBaseJpaContent; -import org.eclipse.jpt.core.internal.context.base.IEntity; -import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType; -import org.eclipse.jpt.core.internal.context.orm.EntityMappings; -import org.eclipse.jpt.core.internal.context.persistence.IClassRef; -import org.eclipse.jpt.core.internal.context.persistence.IPersistenceUnit; -import org.eclipse.jpt.core.internal.resource.orm.OrmArtifactEdit; -import org.eclipse.jpt.core.internal.resource.orm.OrmResource; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceArtifactEdit; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource; -import org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef; -import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence; -import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit; +import org.eclipse.jpt.core.JpaProject; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.context.IBaseJpaContent; +import org.eclipse.jpt.core.context.Entity; +import org.eclipse.jpt.core.context.java.JavaPersistentType; +import org.eclipse.jpt.core.context.orm.EntityMappings; +import org.eclipse.jpt.core.context.persistence.ClassRef; +import org.eclipse.jpt.core.context.persistence.PersistenceUnit; +import org.eclipse.jpt.core.resource.orm.OrmArtifactEdit; +import org.eclipse.jpt.core.resource.orm.OrmResource; +import org.eclipse.jpt.core.resource.persistence.PersistenceArtifactEdit; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceResource; +import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef; +import org.eclipse.jpt.core.resource.persistence.XmlPersistence; +import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit; import org.eclipse.jpt.core.tests.internal.jdtutility.AnnotationTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject; import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject; @@ -88,7 +88,7 @@ public abstract class ContextModelTestCase extends AnnotationTestCase return TestJpaProject.buildJpaProject(projectName, autoBuild); } - protected IJpaProject jpaProject() { + protected JpaProject jpaProject() { return getJavaProject().getJpaProject(); } @@ -129,20 +129,20 @@ public abstract class ContextModelTestCase extends AnnotationTestCase return persistenceResource().getPersistence().getPersistenceUnits().get(0); } - protected IPersistenceUnit persistenceUnit() { + protected PersistenceUnit persistenceUnit() { return jpaContent().getPersistenceXml().getPersistence().persistenceUnits().next(); } - protected IClassRef classRef() { + protected ClassRef classRef() { return persistenceUnit().specifiedClassRefs().next(); } - protected IJavaPersistentType javaPersistentType() { + protected JavaPersistentType javaPersistentType() { return classRef().getJavaPersistentType(); } - protected IEntity javaEntity() { - return (IEntity) javaPersistentType().getMapping(); + protected Entity javaEntity() { + return (Entity) javaPersistentType().getMapping(); } protected void addXmlClassRef(String className) { diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java index ba7508a27f..3aeadc7bdb 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAssociationOverrideTests.java @@ -13,12 +13,12 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.context.base.IAssociationOverride; -import org.eclipse.jpt.core.internal.context.base.IEntity; -import org.eclipse.jpt.core.internal.context.base.IJoinColumn; -import org.eclipse.jpt.core.internal.resource.java.AssociationOverride; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.context.AssociationOverride; +import org.eclipse.jpt.core.context.Entity; +import org.eclipse.jpt.core.context.JoinColumn; +import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -139,10 +139,10 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IAssociationOverride javaAssociationOverride = javaEntity().addSpecifiedAssociationOverride(0); + AssociationOverride javaAssociationOverride = javaEntity().addSpecifiedAssociationOverride(0); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AssociationOverride associationOverrideResource = (AssociationOverride) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); assertNull(javaAssociationOverride.getName()); assertNull(associationOverrideResource.getName()); @@ -171,10 +171,10 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IAssociationOverride javaAssociationOverride = javaEntity().addSpecifiedAssociationOverride(0); + AssociationOverride javaAssociationOverride = javaEntity().addSpecifiedAssociationOverride(0); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AssociationOverride associationOverrideResource = (AssociationOverride) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); assertNull(javaAssociationOverride.getName()); assertNull(associationOverrideResource.getName()); @@ -188,7 +188,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase //set name to null in the context model javaAssociationOverride.setName(null); assertNull(javaAssociationOverride.getName()); - associationOverrideResource = (AssociationOverride) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + associationOverrideResource = (AssociationOverrideAnnotation) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); assertNull(associationOverrideResource.getName()); } @@ -196,31 +196,31 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IAssociationOverride javaAssociationOverride = javaEntity().addSpecifiedAssociationOverride(0); + AssociationOverride javaAssociationOverride = javaEntity().addSpecifiedAssociationOverride(0); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AssociationOverride associationOverrideResource = (AssociationOverride) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); - IJoinColumn joinColumn = javaAssociationOverride.addSpecifiedJoinColumn(0); + JoinColumn joinColumn = javaAssociationOverride.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("FOO"); assertEquals("FOO", associationOverrideResource.joinColumnAt(0).getName()); - IJoinColumn joinColumn2 = javaAssociationOverride.addSpecifiedJoinColumn(0); + JoinColumn joinColumn2 = javaAssociationOverride.addSpecifiedJoinColumn(0); joinColumn2.setSpecifiedName("BAR"); assertEquals("BAR", associationOverrideResource.joinColumnAt(0).getName()); assertEquals("FOO", associationOverrideResource.joinColumnAt(1).getName()); - IJoinColumn joinColumn3 = javaAssociationOverride.addSpecifiedJoinColumn(1); + JoinColumn joinColumn3 = javaAssociationOverride.addSpecifiedJoinColumn(1); joinColumn3.setSpecifiedName("BAZ"); assertEquals("BAR", associationOverrideResource.joinColumnAt(0).getName()); assertEquals("BAZ", associationOverrideResource.joinColumnAt(1).getName()); assertEquals("FOO", associationOverrideResource.joinColumnAt(2).getName()); - ListIterator<IJoinColumn> joinColumns = javaAssociationOverride.specifiedJoinColumns(); + ListIterator<JoinColumn> joinColumns = javaAssociationOverride.specifiedJoinColumns(); assertEquals(joinColumn2, joinColumns.next()); assertEquals(joinColumn3, joinColumns.next()); assertEquals(joinColumn, joinColumns.next()); @@ -235,10 +235,10 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IAssociationOverride javaAssociationOverride = javaEntity().addSpecifiedAssociationOverride(0); + AssociationOverride javaAssociationOverride = javaEntity().addSpecifiedAssociationOverride(0); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AssociationOverride associationOverrideResource = (AssociationOverride) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); javaAssociationOverride.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); javaAssociationOverride.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); @@ -263,10 +263,10 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IAssociationOverride javaAssociationOverride = javaEntity().addSpecifiedAssociationOverride(0); + AssociationOverride javaAssociationOverride = javaEntity().addSpecifiedAssociationOverride(0); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AssociationOverride associationOverrideResource = (AssociationOverride) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); javaAssociationOverride.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); javaAssociationOverride.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); @@ -276,7 +276,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase javaAssociationOverride.moveSpecifiedJoinColumn(2, 0); - ListIterator<IJoinColumn> joinColumns = javaAssociationOverride.specifiedJoinColumns(); + ListIterator<JoinColumn> joinColumns = javaAssociationOverride.specifiedJoinColumns(); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); @@ -301,10 +301,10 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IAssociationOverride javaAssociationOverride = javaEntity().addSpecifiedAssociationOverride(0); + AssociationOverride javaAssociationOverride = javaEntity().addSpecifiedAssociationOverride(0); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AssociationOverride associationOverrideResource = (AssociationOverride) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); associationOverrideResource.addJoinColumn(0); associationOverrideResource.addJoinColumn(1); @@ -314,7 +314,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase associationOverrideResource.joinColumnAt(1).setName("BAR"); associationOverrideResource.joinColumnAt(2).setName("BAZ"); - ListIterator<IJoinColumn> joinColumns = javaAssociationOverride.specifiedJoinColumns(); + ListIterator<JoinColumn> joinColumns = javaAssociationOverride.specifiedJoinColumns(); assertEquals("FOO", joinColumns.next().getName()); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); @@ -356,12 +356,12 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase createTestEntityWithAssociationOverride(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IAssociationOverride specifiedAssociationOverride = javaEntity().specifiedAssociationOverrides().next(); + AssociationOverride specifiedAssociationOverride = javaEntity().specifiedAssociationOverrides().next(); assertEquals(ASSOCIATION_OVERRIDE_NAME, specifiedAssociationOverride.getName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AssociationOverride associationOverrideResource = (AssociationOverride) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); associationOverrideResource.setName("FOO"); specifiedAssociationOverride = javaEntity().specifiedAssociationOverrides().next(); @@ -372,13 +372,13 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase createTestEntityWithAssociationOverride(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IAssociationOverride specifiedAssociationOverride = javaEntity().specifiedAssociationOverrides().next(); + AssociationOverride specifiedAssociationOverride = javaEntity().specifiedAssociationOverrides().next(); assertEquals(ASSOCIATION_OVERRIDE_NAME, specifiedAssociationOverride.getName()); specifiedAssociationOverride.setName("FOO"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AssociationOverride associationOverrideResource = (AssociationOverride) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.annotation(JPA.ASSOCIATION_OVERRIDE); assertEquals("FOO", associationOverrideResource.getName()); } @@ -389,11 +389,11 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); + Entity entity = javaEntity(); assertEquals("AnnotationTestTypeChild", entity.getName()); assertEquals(1, entity.defaultAssociationOverridesSize()); - IAssociationOverride associationOverride = entity.defaultAssociationOverrides().next(); + AssociationOverride associationOverride = entity.defaultAssociationOverrides().next(); assertEquals("address", associationOverride.getName()); } @@ -403,11 +403,11 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); + Entity entity = javaEntity(); assertEquals("AnnotationTestTypeChild", entity.getName()); assertEquals(1, entity.defaultAssociationOverridesSize()); - IAssociationOverride associationOverride = entity.defaultAssociationOverrides().next(); + AssociationOverride associationOverride = entity.defaultAssociationOverrides().next(); assertTrue(associationOverride.isVirtual()); } } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java index 37aa4d3a04..ffeb7a6389 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaAttributeOverrideTests.java @@ -12,15 +12,15 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.context.base.IAttributeOverride; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IColumn; -import org.eclipse.jpt.core.internal.context.base.IEntity; -import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType; -import org.eclipse.jpt.core.internal.resource.java.AttributeOverride; -import org.eclipse.jpt.core.internal.resource.java.Column; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.context.AttributeOverride; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.Column; +import org.eclipse.jpt.core.context.Entity; +import org.eclipse.jpt.core.context.java.JavaPersistentType; +import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.CollectionTools; @@ -135,12 +135,12 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase createTestEntityWithAttributeOverride(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IAttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next(); + AttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next(); assertEquals(ATTRIBUTE_OVERRIDE_NAME, specifiedAttributeOverride.getName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AttributeOverride attributeOverrideResource = (AttributeOverride) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); attributeOverrideResource.setName("FOO"); specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next(); @@ -151,13 +151,13 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase createTestEntityWithAttributeOverride(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IAttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next(); + AttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next(); assertEquals(ATTRIBUTE_OVERRIDE_NAME, specifiedAttributeOverride.getName()); specifiedAttributeOverride.setName("FOO"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AttributeOverride attributeOverrideResource = (AttributeOverride) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); assertEquals("FOO", attributeOverrideResource.getName()); } @@ -166,14 +166,14 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase createTestEntityWithAttributeOverride(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IAttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next(); - IColumn column = specifiedAttributeOverride.getColumn(); + AttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next(); + Column column = specifiedAttributeOverride.getColumn(); assertEquals(ATTRIBUTE_OVERRIDE_COLUMN_NAME, column.getName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AttributeOverride attributeOverrideResource = (AttributeOverride) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); - Column columnResource = attributeOverrideResource.getColumn(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + ColumnAnnotation columnResource = attributeOverrideResource.getColumn(); columnResource.setName("FOO"); @@ -185,20 +185,20 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase createTestEntityWithAttributeOverride(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IAttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next(); - IColumn column = specifiedAttributeOverride.getColumn(); + AttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next(); + Column column = specifiedAttributeOverride.getColumn(); assertEquals(ATTRIBUTE_OVERRIDE_COLUMN_NAME, column.getName()); column.setSpecifiedName("FOO"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AttributeOverride attributeOverrideResource = (AttributeOverride) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); - Column columnResource = attributeOverrideResource.getColumn(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + ColumnAnnotation columnResource = attributeOverrideResource.getColumn(); assertEquals("FOO", columnResource.getName()); column.setSpecifiedName(null); - attributeOverrideResource = (AttributeOverride) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); assertNull(attributeOverrideResource.getColumn()); assertNotNull(specifiedAttributeOverride.getColumn()); } @@ -209,16 +209,16 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); + Entity entity = javaEntity(); assertEquals("AnnotationTestTypeChild", entity.getName()); assertEquals(2, entity.defaultAttributeOverridesSize()); - IAttributeOverride attributeOverride = entity.defaultAttributeOverrides().next(); + AttributeOverride attributeOverride = entity.defaultAttributeOverrides().next(); assertEquals("id", attributeOverride.getColumn().getDefaultName()); - IJavaPersistentType mappedSuperclass = CollectionTools.list(persistenceUnit().specifiedClassRefs()).get(1).getJavaPersistentType(); - IBasicMapping basicMapping = (IBasicMapping) mappedSuperclass.attributeNamed("id").getMapping(); + JavaPersistentType mappedSuperclass = CollectionTools.list(persistenceUnit().specifiedClassRefs()).get(1).getJavaPersistentType(); + BasicMapping basicMapping = (BasicMapping) mappedSuperclass.attributeNamed("id").getMapping(); basicMapping.getColumn().setSpecifiedName("FOO"); attributeOverride = entity.defaultAttributeOverrides().next(); @@ -231,16 +231,16 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); + Entity entity = javaEntity(); assertEquals("AnnotationTestTypeChild", entity.getName()); assertEquals(2, entity.defaultAttributeOverridesSize()); - IAttributeOverride attributeOverride = entity.defaultAttributeOverrides().next(); + AttributeOverride attributeOverride = entity.defaultAttributeOverrides().next(); assertEquals("AnnotationTestTypeChild", attributeOverride.getColumn().getDefaultTable()); - IJavaPersistentType mappedSuperclass = CollectionTools.list(persistenceUnit().specifiedClassRefs()).get(1).getJavaPersistentType(); - IBasicMapping basicMapping = (IBasicMapping) mappedSuperclass.attributeNamed("id").getMapping(); + JavaPersistentType mappedSuperclass = CollectionTools.list(persistenceUnit().specifiedClassRefs()).get(1).getJavaPersistentType(); + BasicMapping basicMapping = (BasicMapping) mappedSuperclass.attributeNamed("id").getMapping(); basicMapping.getColumn().setSpecifiedTable("BAR"); attributeOverride = entity.defaultAttributeOverrides().next(); @@ -253,11 +253,11 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); + Entity entity = javaEntity(); assertEquals("AnnotationTestTypeChild", entity.getName()); assertEquals(2, entity.defaultAttributeOverridesSize()); - IAttributeOverride attributeOverride = entity.defaultAttributeOverrides().next(); + AttributeOverride attributeOverride = entity.defaultAttributeOverrides().next(); assertEquals("id", attributeOverride.getName()); } @@ -267,11 +267,11 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); + Entity entity = javaEntity(); assertEquals("AnnotationTestTypeChild", entity.getName()); assertEquals(2, entity.defaultAttributeOverridesSize()); - IAttributeOverride attributeOverride = entity.defaultAttributeOverrides().next(); + AttributeOverride attributeOverride = entity.defaultAttributeOverrides().next(); assertTrue(attributeOverride.isVirtual()); } @@ -279,14 +279,14 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - IAttributeOverride attributeOverride = entity.addSpecifiedAttributeOverride(0); + Entity entity = javaEntity(); + AttributeOverride attributeOverride = entity.addSpecifiedAttributeOverride(0); attributeOverride.getColumn().setSpecifiedName("FOO"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - AttributeOverride attributeOverrideResource = (AttributeOverride) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); assertEquals("FOO", attributeOverrideResource.getColumn().getName()); assertEquals("FOO", entity.specifiedAttributeOverrides().next().getColumn().getSpecifiedName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java index 6eef141ea9..f16166bd7f 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaBasicMappingTests.java @@ -12,40 +12,40 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.AccessType; -import org.eclipse.jpt.core.internal.context.base.EnumType; -import org.eclipse.jpt.core.internal.context.base.FetchType; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.base.TemporalType; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.Column; -import org.eclipse.jpt.core.internal.resource.java.Embedded; -import org.eclipse.jpt.core.internal.resource.java.EmbeddedId; -import org.eclipse.jpt.core.internal.resource.java.Enumerated; -import org.eclipse.jpt.core.internal.resource.java.Id; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.Lob; -import org.eclipse.jpt.core.internal.resource.java.ManyToOne; -import org.eclipse.jpt.core.internal.resource.java.OneToOne; -import org.eclipse.jpt.core.internal.resource.java.Temporal; -import org.eclipse.jpt.core.internal.resource.java.Transient; -import org.eclipse.jpt.core.internal.resource.java.Version; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.context.AccessType; +import org.eclipse.jpt.core.context.EnumType; +import org.eclipse.jpt.core.context.FetchType; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.TemporalType; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.EmbeddedId; +import org.eclipse.jpt.core.resource.java.Enumerated; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.Lob; +import org.eclipse.jpt.core.resource.java.ManyToOne; +import org.eclipse.jpt.core.resource.java.OneToOne; +import org.eclipse.jpt.core.resource.java.Temporal; +import org.eclipse.jpt.core.resource.java.Transient; +import org.eclipse.jpt.core.resource.java.Version; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -198,8 +198,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertEquals(FetchType.EAGER, basicMapping.getDefaultFetch()); } @@ -207,8 +207,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertEquals(FetchType.EAGER, basicMapping.getDefaultFetch()); } @@ -216,8 +216,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertEquals(FetchType.EAGER, basicMapping.getFetch()); @@ -229,16 +229,16 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertNull(basicMapping.getSpecifiedFetch()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); - basic.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY); + basic.setFetch(org.eclipse.jpt.core.resource.java.FetchType.LAZY); assertEquals(FetchType.LAZY, basicMapping.getSpecifiedFetch()); } @@ -247,8 +247,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMappingFetchOptionalSpecified(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertEquals(FetchType.EAGER, basicMapping.getSpecifiedFetch()); } @@ -257,17 +257,17 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertNull(basicMapping.getSpecifiedFetch()); basicMapping.setSpecifiedFetch(FetchType.LAZY); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, basic.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, basic.getFetch()); basicMapping.setSpecifiedFetch(null); assertNotNull(attributeResource.mappingAnnotation(JPA.BASIC)); @@ -279,27 +279,27 @@ public class JavaBasicMappingTests extends ContextModelTestCase createOrmXmlFile(); entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertNull(basicMapping.getSpecifiedFetch()); assertTrue(basicMapping.isDefault()); basicMapping.setSpecifiedFetch(FetchType.LAZY); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.properties().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.properties().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, basic.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, basic.getFetch()); - basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertEquals(FetchType.LAZY, basicMapping.getSpecifiedFetch()); assertFalse(basicMapping.isDefault()); basicMapping.setSpecifiedFetch(null); assertNotNull(attributeResource.mappingAnnotation(JPA.BASIC)); - basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); } @@ -314,8 +314,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setTemporal(TemporalType.TIME); @@ -323,18 +323,18 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL); assertFalse(basicMapping.isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); attributeResource.setMappingAnnotation(null); assertNotSame(basicMapping, persistentAttribute.getMapping()); - basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertTrue(basicMapping.isDefault()); assertEquals("FOO", basicMapping.getColumn().getSpecifiedName()); - assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Lob.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME)); @@ -344,8 +344,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setLob(true); @@ -355,18 +355,18 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); - assertEquals("FOO", ((IBasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); - assertEquals(TemporalType.TIME, ((IBasicMapping) persistentAttribute.getMapping()).getTemporal()); - assertTrue(((IBasicMapping) persistentAttribute.getMapping()).isLob()); - assertEquals(EnumType.ORDINAL, ((IBasicMapping) persistentAttribute.getMapping()).getEnumerated()); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((BasicMapping) persistentAttribute.getMapping()).getTemporal()); + assertTrue(((BasicMapping) persistentAttribute.getMapping()).isLob()); + assertEquals(EnumType.ORDINAL, ((BasicMapping) persistentAttribute.getMapping()).getEnumerated()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - assertNull(((IBasicMapping) persistentAttribute.getMapping()).getSpecifiedFetch()); - assertNull(((IBasicMapping) persistentAttribute.getMapping()).getSpecifiedOptional()); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + assertNull(((BasicMapping) persistentAttribute.getMapping()).getSpecifiedFetch()); + assertNull(((BasicMapping) persistentAttribute.getMapping()).getSpecifiedOptional()); assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Lob.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME)); @@ -376,8 +376,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setLob(true); @@ -387,15 +387,15 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertEquals("FOO", ((IIdMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); - assertEquals(TemporalType.TIME, ((IIdMapping) persistentAttribute.getMapping()).getTemporal()); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertEquals("FOO", ((IdMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((IdMapping) persistentAttribute.getMapping()).getTemporal()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME)); @@ -405,8 +405,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setTemporal(TemporalType.TIME); @@ -414,15 +414,15 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL); assertFalse(basicMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertEquals("FOO", ((IVersionMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); - assertEquals(TemporalType.TIME, ((IVersionMapping) persistentAttribute.getMapping()).getTemporal()); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertEquals("FOO", ((VersionMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((VersionMapping) persistentAttribute.getMapping()).getTemporal()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME)); @@ -432,8 +432,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setTemporal(TemporalType.TIME); @@ -441,14 +441,14 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL); assertFalse(basicMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME)); @@ -458,8 +458,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setTemporal(TemporalType.TIME); @@ -467,14 +467,14 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL); assertFalse(basicMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME)); @@ -484,8 +484,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setTemporal(TemporalType.TIME); @@ -493,14 +493,14 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedEnumerated(EnumType.ORDINAL); assertFalse(basicMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof TransientMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME)); @@ -510,8 +510,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setTemporal(TemporalType.TIME); @@ -521,16 +521,16 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //TODO assertEquals(FetchType.EAGER, ((IOneToOneMapping) persistentAttribute.getMapping()).getSpecifiedFetch()); // assertEquals(Boolean.FALSE, ((IOneToOneMapping) persistentAttribute.getMapping()).getSpecifiedOptional()); assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME)); @@ -540,8 +540,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setTemporal(TemporalType.TIME); @@ -551,15 +551,15 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //TODO assertEquals(FetchType.EAGER, ((IOneToManyMapping) persistentAttribute.getMapping()).getSpecifiedFetch()); // assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME)); @@ -568,8 +568,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setTemporal(TemporalType.TIME); @@ -579,16 +579,16 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //TODO assertEquals(FetchType.EAGER, ((IManyToOneMapping) persistentAttribute.getMapping()).getSpecifiedFetch()); // assertEquals(Boolean.FALSE, ((IManyToOneMapping) persistentAttribute.getMapping()).getSpecifiedOptional()); assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME)); @@ -598,8 +598,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setTemporal(TemporalType.TIME); @@ -609,15 +609,15 @@ public class JavaBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //TODO assertEquals(FetchType.EAGER, ((IManyToManyMapping) persistentAttribute.getMapping()).getSpecifiedFetch()); // assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); assertNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Lob.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME)); @@ -627,8 +627,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertEquals(Boolean.TRUE, basicMapping.getDefaultOptional()); } @@ -636,8 +636,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertEquals(Boolean.TRUE, basicMapping.getDefaultOptional()); } @@ -645,8 +645,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertEquals(Boolean.TRUE, basicMapping.getOptional()); @@ -658,14 +658,14 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertNull(basicMapping.getSpecifiedOptional()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); basic.setOptional(Boolean.FALSE); @@ -676,8 +676,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMappingFetchOptionalSpecified(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertEquals(Boolean.FALSE, basicMapping.getSpecifiedOptional()); } @@ -686,14 +686,14 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertNull(basicMapping.getSpecifiedOptional()); basicMapping.setSpecifiedOptional(Boolean.FALSE); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); assertEquals(Boolean.FALSE, basic.getOptional()); @@ -706,27 +706,27 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertNull(basicMapping.getSpecifiedOptional()); assertTrue(basicMapping.isDefault()); basicMapping.setSpecifiedOptional(Boolean.TRUE); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); assertEquals(Boolean.TRUE, basic.getOptional()); - basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertEquals(Boolean.TRUE, basicMapping.getSpecifiedOptional()); assertFalse(basicMapping.isDefault()); basicMapping.setSpecifiedOptional(null); assertNotNull(attributeResource.mappingAnnotation(JPA.BASIC)); - basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); } @@ -735,14 +735,14 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertNull(basicMapping.getSpecifiedOptional()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); basic.setOptional(Boolean.FALSE); @@ -757,7 +757,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase attributeResource.setMappingAnnotation(null); assertNull(persistentAttribute.getSpecifiedMapping()); - assertEquals(Boolean.TRUE, ((IBasicMapping) persistentAttribute.getMapping()).getOptional()); + assertEquals(Boolean.TRUE, ((BasicMapping) persistentAttribute.getMapping()).getOptional()); } @@ -765,8 +765,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertFalse(basicMapping.isLob()); } @@ -775,8 +775,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithLob(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertTrue(basicMapping.isLob()); } @@ -785,13 +785,13 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); basicMapping.setLob(true); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNotNull(attributeResource.annotation(Lob.ANNOTATION_NAME)); basicMapping.setLob(false); @@ -802,13 +802,13 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertFalse(basicMapping.isLob()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); attributeResource.addAnnotation(Lob.ANNOTATION_NAME); assertTrue(basicMapping.isLob()); @@ -822,8 +822,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertEquals(EnumType.ORDINAL, basicMapping.getDefaultEnumerated()); } @@ -831,8 +831,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertEquals(EnumType.ORDINAL, basicMapping.getDefaultEnumerated()); } @@ -840,8 +840,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertEquals(EnumType.ORDINAL, basicMapping.getEnumerated()); @@ -853,8 +853,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertNull(basicMapping.getSpecifiedEnumerated()); } @@ -863,8 +863,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithEnumerated(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertEquals(EnumType.STRING, basicMapping.getSpecifiedEnumerated()); } @@ -873,17 +873,17 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertNull(basicMapping.getSpecifiedEnumerated()); basicMapping.setSpecifiedEnumerated(EnumType.STRING); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Enumerated enumerated = (Enumerated) attributeResource.annotation(Enumerated.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.core.internal.resource.java.EnumType.STRING, enumerated.getValue()); + assertEquals(org.eclipse.jpt.core.resource.java.EnumType.STRING, enumerated.getValue()); basicMapping.setSpecifiedEnumerated(null); assertNull(attributeResource.annotation(Enumerated.ANNOTATION_NAME)); @@ -893,16 +893,16 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertNull(basicMapping.getSpecifiedEnumerated()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Enumerated enumerated = (Enumerated) attributeResource.addAnnotation(Enumerated.ANNOTATION_NAME); - enumerated.setValue(org.eclipse.jpt.core.internal.resource.java.EnumType.STRING); + enumerated.setValue(org.eclipse.jpt.core.resource.java.EnumType.STRING); assertEquals(EnumType.STRING, basicMapping.getSpecifiedEnumerated()); @@ -918,8 +918,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertNull(basicMapping.getTemporal()); } @@ -928,8 +928,8 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithTemporal(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping(); assertEquals(TemporalType.TIMESTAMP, basicMapping.getTemporal()); } @@ -938,17 +938,17 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertNull(basicMapping.getTemporal()); basicMapping.setTemporal(TemporalType.TIME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Temporal temporal = (Temporal) attributeResource.annotation(Temporal.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.core.internal.resource.java.TemporalType.TIME, temporal.getValue()); + assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue()); basicMapping.setTemporal(null); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); @@ -958,16 +958,16 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertNull(basicMapping.getTemporal()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Temporal temporal = (Temporal) attributeResource.addAnnotation(Temporal.ANNOTATION_NAME); - temporal.setValue(org.eclipse.jpt.core.internal.resource.java.TemporalType.DATE); + temporal.setValue(org.eclipse.jpt.core.resource.java.TemporalType.DATE); assertEquals(TemporalType.DATE, basicMapping.getTemporal()); @@ -982,15 +982,15 @@ public class JavaBasicMappingTests extends ContextModelTestCase createTestEntityWithBasicMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IBasicMapping basicMapping = (IBasicMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + BasicMapping basicMapping = (BasicMapping) persistentAttribute.getSpecifiedMapping(); assertNull(basicMapping.getColumn().getSpecifiedName()); assertEquals("id", basicMapping.getColumn().getName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setName("foo"); assertEquals("foo", basicMapping.getColumn().getSpecifiedName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java index cd17122989..b630d5f710 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaColumnTests.java @@ -12,14 +12,14 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.context.base.IAbstractColumn; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IColumn; -import org.eclipse.jpt.core.internal.context.base.IEntity; -import org.eclipse.jpt.core.internal.resource.java.Column; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.context.AbstractColumn; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.Column; +import org.eclipse.jpt.core.context.Entity; +import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -140,7 +140,7 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedName()); } @@ -149,7 +149,7 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithDefaultBasicColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertEquals(COLUMN_NAME, basicMapping.getColumn().getSpecifiedName()); } @@ -157,7 +157,7 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetDefaultNameSpecifiedNameNull() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertEquals(basicMapping.persistentAttribute().getName(), basicMapping.getColumn().getDefaultName()); assertEquals("id", basicMapping.getColumn().getDefaultName()); @@ -167,7 +167,7 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithDefaultBasicColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertEquals("id", basicMapping.getColumn().getDefaultName()); basicMapping.getColumn().setSpecifiedName("foo"); @@ -177,7 +177,7 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetNameSpecifiedNameNull() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertEquals("id", basicMapping.getColumn().getName()); } @@ -185,7 +185,7 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetName() throws Exception { createTestEntityWithDefaultBasicColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertEquals(COLUMN_NAME, basicMapping.getColumn().getName()); } @@ -193,15 +193,15 @@ public class JavaColumnTests extends ContextModelTestCase public void testSetSpecifiedName() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); basicMapping.getColumn().setSpecifiedName("foo"); assertEquals("foo", basicMapping.getColumn().getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals("foo", column.getName()); } @@ -210,27 +210,27 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithDefaultBasicColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); basicMapping.getColumn().setSpecifiedName(null); assertNull(basicMapping.getColumn().getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.annotation(JPA.COLUMN)); } public void testGetNameUpdatesFromResourceChange() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setName("foo"); assertEquals("foo", basicMapping.getColumn().getSpecifiedName()); @@ -256,7 +256,7 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedTable()); } @@ -265,7 +265,7 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnTableSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertEquals(TABLE_NAME, basicMapping.getColumn().getSpecifiedTable()); } @@ -273,9 +273,9 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetDefaultTableSpecifiedTableNull() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(((IEntity) basicMapping.typeMapping()).getName(), basicMapping.getColumn().getDefaultTable()); + assertEquals(((Entity) basicMapping.typeMapping()).getName(), basicMapping.getColumn().getDefaultTable()); assertEquals(TYPE_NAME, basicMapping.getColumn().getDefaultTable()); } @@ -283,7 +283,7 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithDefaultBasicColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertEquals(TYPE_NAME, basicMapping.getColumn().getDefaultTable()); basicMapping.getColumn().setSpecifiedTable("foo"); @@ -293,7 +293,7 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetTable() throws Exception { createTestEntityWithBasicColumnTableSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertEquals(TABLE_NAME, basicMapping.getColumn().getTable()); } @@ -301,15 +301,15 @@ public class JavaColumnTests extends ContextModelTestCase public void testSetSpecifiedTable() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); basicMapping.getColumn().setSpecifiedTable("foo"); assertEquals("foo", basicMapping.getColumn().getSpecifiedTable()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals("foo", column.getTable()); } @@ -318,27 +318,27 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnTableSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); basicMapping.getColumn().setSpecifiedTable(null); assertNull(basicMapping.getColumn().getSpecifiedTable()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.annotation(JPA.COLUMN)); } public void testGetTableUpdatesFromResourceChange() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedTable()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setTable("foo"); assertEquals("foo", basicMapping.getColumn().getSpecifiedTable()); @@ -351,7 +351,7 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetColumnDefinition() throws Exception { createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertEquals(COLUMN_DEFINITION, basicMapping.getColumn().getColumnDefinition()); } @@ -359,13 +359,13 @@ public class JavaColumnTests extends ContextModelTestCase public void testSetColumnDefinition() throws Exception { createTestEntityWithBasicColumnTableSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); basicMapping.getColumn().setColumnDefinition("foo"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals("foo", column.getColumnDefinition()); @@ -376,13 +376,13 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetColumnDefinitionUpdatesFromResourceChange() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getColumnDefinition()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setColumnDefinition("foo"); assertEquals("foo", basicMapping.getColumn().getColumnDefinition()); @@ -395,9 +395,9 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetLength() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IColumn.DEFAULT_LENGTH, basicMapping.getColumn().getLength()); + assertEquals(Column.DEFAULT_LENGTH, basicMapping.getColumn().getLength()); basicMapping.getColumn().setSpecifiedLength(Integer.valueOf(55)); assertEquals(Integer.valueOf(55), basicMapping.getColumn().getLength()); } @@ -406,25 +406,25 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IColumn.DEFAULT_LENGTH, basicMapping.getColumn().getDefaultLength()); + assertEquals(Column.DEFAULT_LENGTH, basicMapping.getColumn().getDefaultLength()); basicMapping.getColumn().setSpecifiedLength(Integer.valueOf(55)); - assertEquals(IColumn.DEFAULT_LENGTH, basicMapping.getColumn().getDefaultLength()); + assertEquals(Column.DEFAULT_LENGTH, basicMapping.getColumn().getDefaultLength()); } public void testGetSpecifiedLength() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedLength()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setLength(Integer.valueOf(66)); assertEquals(Integer.valueOf(66), basicMapping.getColumn().getSpecifiedLength()); @@ -440,15 +440,15 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedLength()); basicMapping.getColumn().setSpecifiedLength(Integer.valueOf(100)); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Integer.valueOf(100), column.getLength()); @@ -460,9 +460,9 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetPrecision() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IColumn.DEFAULT_PRECISION, basicMapping.getColumn().getPrecision()); + assertEquals(Column.DEFAULT_PRECISION, basicMapping.getColumn().getPrecision()); basicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(55)); assertEquals(Integer.valueOf(55), basicMapping.getColumn().getPrecision()); } @@ -471,25 +471,25 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IColumn.DEFAULT_PRECISION, basicMapping.getColumn().getDefaultPrecision()); + assertEquals(Column.DEFAULT_PRECISION, basicMapping.getColumn().getDefaultPrecision()); basicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(55)); - assertEquals(IColumn.DEFAULT_PRECISION, basicMapping.getColumn().getDefaultPrecision()); + assertEquals(Column.DEFAULT_PRECISION, basicMapping.getColumn().getDefaultPrecision()); } public void testGetSpecifiedPrecision() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedPrecision()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setPrecision(Integer.valueOf(66)); assertEquals(Integer.valueOf(66), basicMapping.getColumn().getSpecifiedPrecision()); @@ -505,15 +505,15 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedPrecision()); basicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(100)); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Integer.valueOf(100), column.getPrecision()); @@ -525,9 +525,9 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetScale() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IColumn.DEFAULT_SCALE, basicMapping.getColumn().getScale()); + assertEquals(Column.DEFAULT_SCALE, basicMapping.getColumn().getScale()); basicMapping.getColumn().setSpecifiedScale(Integer.valueOf(55)); assertEquals(Integer.valueOf(55), basicMapping.getColumn().getScale()); } @@ -536,25 +536,25 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IColumn.DEFAULT_SCALE, basicMapping.getColumn().getDefaultScale()); + assertEquals(Column.DEFAULT_SCALE, basicMapping.getColumn().getDefaultScale()); basicMapping.getColumn().setSpecifiedScale(Integer.valueOf(55)); - assertEquals(IColumn.DEFAULT_SCALE, basicMapping.getColumn().getDefaultScale()); + assertEquals(Column.DEFAULT_SCALE, basicMapping.getColumn().getDefaultScale()); } public void testGetSpecifiedScale() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedScale()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setScale(Integer.valueOf(66)); assertEquals(Integer.valueOf(66), basicMapping.getColumn().getSpecifiedScale()); @@ -570,15 +570,15 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedScale()); basicMapping.getColumn().setSpecifiedScale(Integer.valueOf(100)); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Integer.valueOf(100), column.getScale()); @@ -590,9 +590,9 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetUnique() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IAbstractColumn.DEFAULT_UNIQUE, basicMapping.getColumn().getUnique()); + assertEquals(AbstractColumn.DEFAULT_UNIQUE, basicMapping.getColumn().getUnique()); basicMapping.getColumn().setSpecifiedUnique(Boolean.TRUE); assertEquals(Boolean.TRUE, basicMapping.getColumn().getUnique()); } @@ -601,25 +601,25 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IAbstractColumn.DEFAULT_UNIQUE, basicMapping.getColumn().getDefaultUnique()); + assertEquals(AbstractColumn.DEFAULT_UNIQUE, basicMapping.getColumn().getDefaultUnique()); basicMapping.getColumn().setSpecifiedUnique(Boolean.TRUE); - assertEquals(IAbstractColumn.DEFAULT_UNIQUE, basicMapping.getColumn().getDefaultUnique()); + assertEquals(AbstractColumn.DEFAULT_UNIQUE, basicMapping.getColumn().getDefaultUnique()); } public void testGetSpecifiedUnique() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedUnique()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setUnique(Boolean.TRUE); assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedUnique()); @@ -635,15 +635,15 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedUnique()); basicMapping.getColumn().setSpecifiedUnique(Boolean.FALSE); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Boolean.FALSE, column.getUnique()); @@ -655,9 +655,9 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetInsertable() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IAbstractColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().getInsertable()); + assertEquals(AbstractColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().getInsertable()); basicMapping.getColumn().setSpecifiedInsertable(Boolean.TRUE); assertEquals(Boolean.TRUE, basicMapping.getColumn().getInsertable()); } @@ -666,25 +666,25 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IAbstractColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().getDefaultInsertable()); + assertEquals(AbstractColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().getDefaultInsertable()); basicMapping.getColumn().setSpecifiedInsertable(Boolean.TRUE); - assertEquals(IAbstractColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().getDefaultInsertable()); + assertEquals(AbstractColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().getDefaultInsertable()); } public void testGetSpecifiedInsertable() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedInsertable()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setInsertable(Boolean.TRUE); assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedInsertable()); @@ -700,15 +700,15 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedInsertable()); basicMapping.getColumn().setSpecifiedInsertable(Boolean.FALSE); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Boolean.FALSE, column.getInsertable()); @@ -720,9 +720,9 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetNullable() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IAbstractColumn.DEFAULT_NULLABLE, basicMapping.getColumn().getNullable()); + assertEquals(AbstractColumn.DEFAULT_NULLABLE, basicMapping.getColumn().getNullable()); basicMapping.getColumn().setSpecifiedNullable(Boolean.TRUE); assertEquals(Boolean.TRUE, basicMapping.getColumn().getNullable()); } @@ -731,25 +731,25 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IAbstractColumn.DEFAULT_NULLABLE, basicMapping.getColumn().getDefaultNullable()); + assertEquals(AbstractColumn.DEFAULT_NULLABLE, basicMapping.getColumn().getDefaultNullable()); basicMapping.getColumn().setSpecifiedNullable(Boolean.TRUE); - assertEquals(IAbstractColumn.DEFAULT_NULLABLE, basicMapping.getColumn().getDefaultNullable()); + assertEquals(AbstractColumn.DEFAULT_NULLABLE, basicMapping.getColumn().getDefaultNullable()); } public void testGetSpecifiedNullable() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedNullable()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setNullable(Boolean.TRUE); assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedNullable()); @@ -765,15 +765,15 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedNullable()); basicMapping.getColumn().setSpecifiedNullable(Boolean.FALSE); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Boolean.FALSE, column.getNullable()); @@ -785,9 +785,9 @@ public class JavaColumnTests extends ContextModelTestCase public void testGetUpdatable() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IAbstractColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().getUpdatable()); + assertEquals(AbstractColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().getUpdatable()); basicMapping.getColumn().setSpecifiedUpdatable(Boolean.TRUE); assertEquals(Boolean.TRUE, basicMapping.getColumn().getUpdatable()); } @@ -796,25 +796,25 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); - assertEquals(IAbstractColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().getDefaultUpdatable()); + assertEquals(AbstractColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().getDefaultUpdatable()); basicMapping.getColumn().setSpecifiedUpdatable(Boolean.TRUE); - assertEquals(IAbstractColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().getDefaultUpdatable()); + assertEquals(AbstractColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().getDefaultUpdatable()); } public void testGetSpecifiedUpdatable() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedUpdatable()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setUpdatable(Boolean.TRUE); assertEquals(Boolean.TRUE, basicMapping.getColumn().getSpecifiedUpdatable()); @@ -830,15 +830,15 @@ public class JavaColumnTests extends ContextModelTestCase createTestEntityWithBasicColumnColumnDefinitionSet(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IBasicMapping basicMapping = (IBasicMapping) javaPersistentType().attributes().next().getMapping(); + BasicMapping basicMapping = (BasicMapping) javaPersistentType().attributes().next().getMapping(); assertNull(basicMapping.getColumn().getSpecifiedUpdatable()); basicMapping.getColumn().setSpecifiedUpdatable(Boolean.FALSE); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Boolean.FALSE, column.getUpdatable()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java index a6e3b8fe29..de89d2c18f 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java @@ -12,11 +12,11 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.context.base.DiscriminatorType; -import org.eclipse.jpt.core.internal.context.base.IDiscriminatorColumn; -import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumn; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.context.DiscriminatorType; +import org.eclipse.jpt.core.context.DiscriminatorColumn; +import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -127,8 +127,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertEquals("foo", javaEntity().getDiscriminatorColumn().getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertEquals("foo", discriminatorColumn.getName()); } @@ -141,8 +141,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertNull(discriminatorColumn); } @@ -171,9 +171,9 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); - discriminatorColumn.setDiscriminatorType(org.eclipse.jpt.core.internal.resource.java.DiscriminatorType.CHAR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + discriminatorColumn.setDiscriminatorType(org.eclipse.jpt.core.resource.java.DiscriminatorType.CHAR); assertEquals(DiscriminatorType.CHAR, javaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType()); } @@ -186,10 +186,10 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase javaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.CHAR); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); - assertEquals(org.eclipse.jpt.core.internal.resource.java.DiscriminatorType.CHAR, discriminatorColumn.getDiscriminatorType()); + assertEquals(org.eclipse.jpt.core.resource.java.DiscriminatorType.CHAR, discriminatorColumn.getDiscriminatorType()); javaEntity().getDiscriminatorColumn().setSpecifiedName(null); javaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(null); @@ -202,23 +202,23 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN); - column.setDiscriminatorType(org.eclipse.jpt.core.internal.resource.java.DiscriminatorType.INTEGER); + column.setDiscriminatorType(org.eclipse.jpt.core.resource.java.DiscriminatorType.INTEGER); assertEquals(DiscriminatorType.INTEGER, javaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType()); assertEquals(DiscriminatorType.INTEGER, javaEntity().getDiscriminatorColumn().getDiscriminatorType()); column.setDiscriminatorType(null); assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType()); - assertEquals(IDiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, javaEntity().getDiscriminatorColumn().getDiscriminatorType()); + assertEquals(DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE, javaEntity().getDiscriminatorColumn().getDiscriminatorType()); } public void testGetLength() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(IDiscriminatorColumn.DEFAULT_LENGTH, javaEntity().getDiscriminatorColumn().getLength()); + assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, javaEntity().getDiscriminatorColumn().getLength()); javaEntity().getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(55)); assertEquals(Integer.valueOf(55), javaEntity().getDiscriminatorColumn().getLength()); } @@ -227,10 +227,10 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase createTestEntityWithDiscriminatorColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(IDiscriminatorColumn.DEFAULT_LENGTH, javaEntity().getDiscriminatorColumn().getDefaultLength()); + assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, javaEntity().getDiscriminatorColumn().getDefaultLength()); javaEntity().getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(55)); - assertEquals(IDiscriminatorColumn.DEFAULT_LENGTH, javaEntity().getDiscriminatorColumn().getDefaultLength()); + assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, javaEntity().getDiscriminatorColumn().getDefaultLength()); } public void testGetSpecifiedLength() throws Exception { @@ -239,8 +239,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedLength()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); discriminatorColumn.setLength(Integer.valueOf(66)); assertEquals(Integer.valueOf(66), javaEntity().getDiscriminatorColumn().getSpecifiedLength()); @@ -260,8 +260,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase javaEntity().getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(100)); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumn discriminatorColumn = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(Integer.valueOf(100), discriminatorColumn.getLength()); @@ -276,8 +276,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedLength()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN); column.setLength(Integer.valueOf(78)); assertEquals(Integer.valueOf(78), javaEntity().getDiscriminatorColumn().getSpecifiedLength()); @@ -285,7 +285,7 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase column.setLength(null); assertNull(javaEntity().getDiscriminatorColumn().getSpecifiedLength()); - assertEquals(IDiscriminatorColumn.DEFAULT_LENGTH, javaEntity().getDiscriminatorColumn().getLength()); + assertEquals(DiscriminatorColumn.DEFAULT_LENGTH, javaEntity().getDiscriminatorColumn().getLength()); } @@ -295,8 +295,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase assertNull(javaEntity().getDiscriminatorColumn().getColumnDefinition()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); column.setColumnDefinition(COLUMN_DEFINITION); assertEquals(COLUMN_DEFINITION, javaEntity().getDiscriminatorColumn().getColumnDefinition()); @@ -314,13 +314,13 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase javaEntity().getDiscriminatorColumn().setColumnDefinition("foo"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertEquals("foo", column.getColumnDefinition()); javaEntity().getDiscriminatorColumn().setColumnDefinition(null); - column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertNull(column.getColumnDefinition()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java index 1e2d1fa84f..015d559ad2 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddableTests.java @@ -12,14 +12,14 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.IEmbeddable; -import org.eclipse.jpt.core.internal.context.base.IEntity; -import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.Embeddable; +import org.eclipse.jpt.core.context.Entity; +import org.eclipse.jpt.core.context.MappedSuperclass; import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMapping; -import org.eclipse.jpt.core.internal.resource.java.Embeddable; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -54,46 +54,46 @@ public class JavaEmbeddableTests extends ContextModelTestCase createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - javaPersistentType().setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY); - assertTrue(javaPersistentType().getMapping() instanceof IEntity); + javaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY); + assertTrue(javaPersistentType().getMapping() instanceof Entity); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.mappingAnnotation(Embeddable.ANNOTATION_NAME)); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + assertNull(typeResource.mappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME)); } public void testMorphToMappedSuperclass() throws Exception { createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - javaPersistentType().setMappingKey(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); - assertTrue(javaPersistentType().getMapping() instanceof IMappedSuperclass); + javaPersistentType().setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); + assertTrue(javaPersistentType().getMapping() instanceof MappedSuperclass); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.mappingAnnotation(Embeddable.ANNOTATION_NAME)); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + assertNull(typeResource.mappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME)); } public void testMorphToNull() throws Exception { createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - javaPersistentType().setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY); + javaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY); assertTrue(javaPersistentType().getMapping() instanceof JavaNullTypeMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.mappingAnnotation(Embeddable.ANNOTATION_NAME)); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + assertNull(typeResource.mappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME)); } public void testEmbeddable() throws Exception { createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertTrue(javaPersistentType().getMapping() instanceof IEmbeddable); + assertTrue(javaPersistentType().getMapping() instanceof Embeddable); } public void testOverridableAttributeNames() throws Exception { createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping(); + Embeddable embeddable = (Embeddable) javaPersistentType().getMapping(); Iterator<String> overridableAttributeNames = embeddable.overridableAttributeNames(); assertFalse(overridableAttributeNames.hasNext()); } @@ -102,7 +102,7 @@ public class JavaEmbeddableTests extends ContextModelTestCase createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping(); + Embeddable embeddable = (Embeddable) javaPersistentType().getMapping(); Iterator<String> overridableAssociationNames = embeddable.overridableAssociationNames(); assertFalse(overridableAssociationNames.hasNext()); } @@ -111,7 +111,7 @@ public class JavaEmbeddableTests extends ContextModelTestCase createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping(); + Embeddable embeddable = (Embeddable) javaPersistentType().getMapping(); assertFalse(embeddable.tableNameIsInvalid(FULLY_QUALIFIED_TYPE_NAME)); assertFalse(embeddable.tableNameIsInvalid("FOO")); @@ -121,17 +121,17 @@ public class JavaEmbeddableTests extends ContextModelTestCase createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping(); - assertTrue(embeddable.attributeMappingKeyAllowed(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY)); - assertTrue(embeddable.attributeMappingKeyAllowed(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY)); - assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY)); - assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY)); - assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)); - assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY)); - assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY)); - assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY)); - assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY)); - assertFalse(embeddable.attributeMappingKeyAllowed(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY)); + Embeddable embeddable = (Embeddable) javaPersistentType().getMapping(); + assertTrue(embeddable.attributeMappingKeyAllowed(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY)); + assertTrue(embeddable.attributeMappingKeyAllowed(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY)); + assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY)); + assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY)); + assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)); + assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY)); + assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY)); + assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY)); + assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY)); + assertFalse(embeddable.attributeMappingKeyAllowed(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY)); } @@ -139,7 +139,7 @@ public class JavaEmbeddableTests extends ContextModelTestCase createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping(); + Embeddable embeddable = (Embeddable) javaPersistentType().getMapping(); assertFalse(embeddable.associatedTables().hasNext()); } @@ -148,7 +148,7 @@ public class JavaEmbeddableTests extends ContextModelTestCase createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping(); + Embeddable embeddable = (Embeddable) javaPersistentType().getMapping(); assertFalse(embeddable.associatedTablesIncludingInherited().hasNext()); } @@ -157,7 +157,7 @@ public class JavaEmbeddableTests extends ContextModelTestCase createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping(); + Embeddable embeddable = (Embeddable) javaPersistentType().getMapping(); assertFalse(embeddable.associatedTableNamesIncludingInherited().hasNext()); } @@ -166,7 +166,7 @@ public class JavaEmbeddableTests extends ContextModelTestCase createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping(); + Embeddable embeddable = (Embeddable) javaPersistentType().getMapping(); Iterator<String> overridableAttributeNames = embeddable.overridableAttributeNames(); assertFalse(overridableAttributeNames.hasNext()); } @@ -176,7 +176,7 @@ public class JavaEmbeddableTests extends ContextModelTestCase createTestEmbeddable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEmbeddable embeddable = (IEmbeddable) javaPersistentType().getMapping(); + Embeddable embeddable = (Embeddable) javaPersistentType().getMapping(); Iterator<String> overridableAssociationNames = embeddable.overridableAssociationNames(); assertFalse(overridableAssociationNames.hasNext()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java index f06b50ea5b..55bb0574a5 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java @@ -13,39 +13,39 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.IAttributeOverride; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddable; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.java.IJavaAttributeOverride; -import org.eclipse.jpt.core.internal.context.java.JavaNullAttributeMapping; -import org.eclipse.jpt.core.internal.context.persistence.IClassRef; -import org.eclipse.jpt.core.internal.resource.java.AttributeOverride; -import org.eclipse.jpt.core.internal.resource.java.AttributeOverrides; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.Embedded; -import org.eclipse.jpt.core.internal.resource.java.EmbeddedId; -import org.eclipse.jpt.core.internal.resource.java.Id; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.ManyToMany; -import org.eclipse.jpt.core.internal.resource.java.ManyToOne; -import org.eclipse.jpt.core.internal.resource.java.OneToMany; -import org.eclipse.jpt.core.internal.resource.java.OneToOne; -import org.eclipse.jpt.core.internal.resource.java.Transient; -import org.eclipse.jpt.core.internal.resource.java.Version; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.AttributeOverride; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.Embeddable; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.java.JavaAttributeOverride; +import org.eclipse.jpt.core.context.persistence.ClassRef; +import org.eclipse.jpt.core.internal.context.java.GenericJavaNullAttributeMapping; +import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.AttributeOverrides; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.EmbeddedId; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.ManyToMany; +import org.eclipse.jpt.core.resource.java.ManyToOne; +import org.eclipse.jpt.core.resource.java.OneToMany; +import org.eclipse.jpt.core.resource.java.OneToOne; +import org.eclipse.jpt.core.resource.java.Transient; +import org.eclipse.jpt.core.resource.java.Version; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.CollectionTools; @@ -127,20 +127,20 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedIdMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof BasicMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { @@ -149,19 +149,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedIdMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); - assertTrue(((IEmbeddedMapping) persistentAttribute.getMapping()).attributeOverrides().hasNext()); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + assertTrue(((EmbeddedMapping) persistentAttribute.getMapping()).attributeOverrides().hasNext()); assertTrue(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testDefaultEmbeddedIdMapping() throws Exception { @@ -169,16 +169,16 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); assertFalse(embeddedIdMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof JavaNullAttributeMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof GenericJavaNullAttributeMapping); assertTrue(persistentAttribute.getMapping().isDefault()); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); assertTrue(persistentAttribute.getMapping().isDefault()); } @@ -187,19 +187,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedIdMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof VersionMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { @@ -207,19 +207,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedIdMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof TransientMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToIdMapping() throws Exception { @@ -227,19 +227,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedIdMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof IdMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedMapping() throws Exception { @@ -247,19 +247,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedIdMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToOneMapping() throws Exception { @@ -267,19 +267,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedIdMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { @@ -287,19 +287,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedIdMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToOneMapping() throws Exception { @@ -307,19 +307,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedIdMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { @@ -327,19 +327,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedIdMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testSpecifiedAttributeOverrides() throws Exception { @@ -348,23 +348,23 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); - ListIterator<IJavaAttributeOverride> specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); + ListIterator<JavaAttributeOverride> specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertFalse(specifiedAttributeOverrides.hasNext()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); @@ -372,7 +372,7 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAZ"); specifiedAttributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); @@ -411,25 +411,25 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertEquals("myEmbeddedId", attributeResource.getName()); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(AttributeOverrides.ANNOTATION_NAME)); assertEquals(2, embeddedIdMapping.defaultAttributeOverridesSize()); - IAttributeOverride defaultAttributeOverride = embeddedIdMapping.defaultAttributeOverrides().next(); + AttributeOverride defaultAttributeOverride = embeddedIdMapping.defaultAttributeOverrides().next(); assertEquals("city", defaultAttributeOverride.getName()); assertEquals("city", defaultAttributeOverride.getColumn().getName()); assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable()); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IEmbeddable embeddable = (IEmbeddable) classRefs.next().getJavaPersistentType().getMapping(); + Embeddable embeddable = (Embeddable) classRefs.next().getJavaPersistentType().getMapping(); - IBasicMapping cityMapping = (IBasicMapping) embeddable.persistentType().attributeNamed("city").getMapping(); + BasicMapping cityMapping = (BasicMapping) embeddable.persistentType().attributeNamed("city").getMapping(); cityMapping.getColumn().setSpecifiedName("FOO"); cityMapping.getColumn().setSpecifiedTable("BAR"); @@ -456,16 +456,16 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); assertEquals(0, embeddedIdMapping.specifiedAttributeOverridesSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertEquals(2, embeddedIdMapping.specifiedAttributeOverridesSize()); @@ -477,21 +477,21 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); assertEquals(2, embeddedIdMapping.attributeOverridesSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertEquals(4, embeddedIdMapping.attributeOverridesSize()); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("city"); assertEquals(4, embeddedIdMapping.attributeOverridesSize()); } @@ -502,23 +502,23 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); assertEquals(2, embeddedIdMapping.defaultAttributeOverridesSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); assertEquals(2, embeddedIdMapping.defaultAttributeOverridesSize()); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("city"); assertEquals(1, embeddedIdMapping.defaultAttributeOverridesSize()); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("state"); assertEquals(0, embeddedIdMapping.defaultAttributeOverridesSize()); } @@ -529,18 +529,18 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("FOO"); embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("BAR"); embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Iterator<JavaResource> attributeOverrides = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + Iterator<JavaResourceNode> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName()); + assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("BAR", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertFalse(attributeOverrides.hasNext()); } @@ -550,18 +550,18 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("FOO"); embeddedIdMapping.addSpecifiedAttributeOverride(1).setName("BAR"); embeddedIdMapping.addSpecifiedAttributeOverride(2).setName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Iterator<JavaResource> attributeOverrides = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + Iterator<JavaResourceNode> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName()); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("BAR", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertFalse(attributeOverrides.hasNext()); } @@ -571,32 +571,32 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("FOO"); embeddedIdMapping.addSpecifiedAttributeOverride(1).setName("BAR"); embeddedIdMapping.addSpecifiedAttributeOverride(2).setName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - assertEquals(3, CollectionTools.size(attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME))); embeddedIdMapping.removeSpecifiedAttributeOverride(1); - Iterator<JavaResource> attributeOverrideResources = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("FOO", ((AttributeOverride) attributeOverrideResources.next()).getName()); - assertEquals("BAZ", ((AttributeOverride) attributeOverrideResources.next()).getName()); + Iterator<JavaResourceNode> attributeOverrideResources = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); + assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); assertFalse(attributeOverrideResources.hasNext()); - Iterator<IAttributeOverride> attributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); + Iterator<AttributeOverride> attributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertEquals("FOO", attributeOverrides.next().getName()); assertEquals("BAZ", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); embeddedIdMapping.removeSpecifiedAttributeOverride(1); - attributeOverrideResources = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("FOO", ((AttributeOverride) attributeOverrideResources.next()).getName()); + attributeOverrideResources = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); assertFalse(attributeOverrideResources.hasNext()); attributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); @@ -605,7 +605,7 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase embeddedIdMapping.removeSpecifiedAttributeOverride(0); - attributeOverrideResources = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + attributeOverrideResources = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); assertFalse(attributeOverrideResources.hasNext()); attributeOverrides = embeddedIdMapping.specifiedAttributeOverrides(); assertFalse(attributeOverrides.hasNext()); @@ -619,21 +619,21 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("FOO"); embeddedIdMapping.addSpecifiedAttributeOverride(1).setName("BAR"); embeddedIdMapping.addSpecifiedAttributeOverride(2).setName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); attributeResource.move(2, 0, AttributeOverrides.ANNOTATION_NAME); - Iterator<JavaResource> attributeOverrides = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + Iterator<JavaResourceNode> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName()); + assertEquals("BAR", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); } public void testAttributeOverrideIsVirtual() throws Exception { @@ -642,9 +642,9 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); - ListIterator<IAttributeOverride> defaultAttributeOverrides = embeddedIdMapping.defaultAttributeOverrides(); - IAttributeOverride defaultAttributeOverride = defaultAttributeOverrides.next(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) javaPersistentType().attributeNamed("myEmbeddedId").getMapping(); + ListIterator<AttributeOverride> defaultAttributeOverrides = embeddedIdMapping.defaultAttributeOverrides(); + AttributeOverride defaultAttributeOverride = defaultAttributeOverrides.next(); assertEquals("city", defaultAttributeOverride.getName()); assertTrue(defaultAttributeOverride.isVirtual()); @@ -654,7 +654,7 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase assertFalse(defaultAttributeOverrides.hasNext()); embeddedIdMapping.addSpecifiedAttributeOverride(0).setName("state"); - IAttributeOverride specifiedAttributeOverride = embeddedIdMapping.specifiedAttributeOverrides().next(); + AttributeOverride specifiedAttributeOverride = embeddedIdMapping.specifiedAttributeOverrides().next(); assertFalse(specifiedAttributeOverride.isVirtual()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java index 7e5d2ac260..d3df87299e 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEmbeddedMappingTests.java @@ -13,39 +13,39 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.IAttributeOverride; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddable; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.java.IJavaAttributeOverride; -import org.eclipse.jpt.core.internal.context.java.JavaNullAttributeMapping; -import org.eclipse.jpt.core.internal.context.persistence.IClassRef; -import org.eclipse.jpt.core.internal.resource.java.AttributeOverride; -import org.eclipse.jpt.core.internal.resource.java.AttributeOverrides; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.Embedded; -import org.eclipse.jpt.core.internal.resource.java.EmbeddedId; -import org.eclipse.jpt.core.internal.resource.java.Id; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.ManyToMany; -import org.eclipse.jpt.core.internal.resource.java.ManyToOne; -import org.eclipse.jpt.core.internal.resource.java.OneToMany; -import org.eclipse.jpt.core.internal.resource.java.OneToOne; -import org.eclipse.jpt.core.internal.resource.java.Transient; -import org.eclipse.jpt.core.internal.resource.java.Version; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.AttributeOverride; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.Embeddable; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.java.JavaAttributeOverride; +import org.eclipse.jpt.core.context.persistence.ClassRef; +import org.eclipse.jpt.core.internal.context.java.GenericJavaNullAttributeMapping; +import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.AttributeOverrides; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.EmbeddedId; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.ManyToMany; +import org.eclipse.jpt.core.resource.java.ManyToOne; +import org.eclipse.jpt.core.resource.java.OneToMany; +import org.eclipse.jpt.core.resource.java.OneToOne; +import org.eclipse.jpt.core.resource.java.Transient; +import org.eclipse.jpt.core.resource.java.Version; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.CollectionTools; @@ -126,19 +126,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); assertFalse(embeddedMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof BasicMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { @@ -147,19 +147,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); - assertTrue(((IEmbeddedMapping) persistentAttribute.getMapping()).attributeOverrides().hasNext()); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + assertTrue(((EmbeddedMapping) persistentAttribute.getMapping()).attributeOverrides().hasNext()); assertTrue(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testDefaultEmbeddedMapping() throws Exception { @@ -167,16 +167,16 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); assertFalse(embeddedMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof JavaNullAttributeMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof GenericJavaNullAttributeMapping); assertTrue(persistentAttribute.getMapping().isDefault()); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); assertTrue(persistentAttribute.getMapping().isDefault()); } @@ -185,19 +185,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof VersionMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { @@ -205,19 +205,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof TransientMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToIdMapping() throws Exception { @@ -225,19 +225,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof IdMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedIdMapping() throws Exception { @@ -245,19 +245,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToOneMapping() throws Exception { @@ -265,19 +265,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { @@ -285,19 +285,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToOneMapping() throws Exception { @@ -305,19 +305,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { @@ -325,19 +325,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase createEmbeddableType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0); assertFalse(embeddedMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); } public void testSpecifiedAttributeOverrides() throws Exception { @@ -346,23 +346,23 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); - ListIterator<IJavaAttributeOverride> specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides(); + ListIterator<JavaAttributeOverride> specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertFalse(specifiedAttributeOverrides.hasNext()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); @@ -370,7 +370,7 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAZ"); specifiedAttributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); @@ -409,31 +409,31 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertEquals("myEmbedded", attributeResource.getName()); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(AttributeOverrides.ANNOTATION_NAME)); assertEquals(2, embeddedMapping.defaultAttributeOverridesSize()); - IAttributeOverride defaultAttributeOverride = embeddedMapping.defaultAttributeOverrides().next(); + AttributeOverride defaultAttributeOverride = embeddedMapping.defaultAttributeOverrides().next(); assertEquals("city", defaultAttributeOverride.getName()); assertEquals("city", defaultAttributeOverride.getColumn().getName()); assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable()); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IEmbeddable embeddable = (IEmbeddable) classRefs.next().getJavaPersistentType().getMapping(); + Embeddable embeddable = (Embeddable) classRefs.next().getJavaPersistentType().getMapping(); - IBasicMapping cityMapping = (IBasicMapping) embeddable.persistentType().attributeNamed("city").getMapping(); + BasicMapping cityMapping = (BasicMapping) embeddable.persistentType().attributeNamed("city").getMapping(); cityMapping.getColumn().setSpecifiedName("FOO"); cityMapping.getColumn().setSpecifiedTable("BAR"); assertEquals("myEmbedded", attributeResource.getName()); - assertNull(attributeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(AttributeOverrides.ANNOTATION_NAME)); assertEquals(2, embeddedMapping.defaultAttributeOverridesSize()); @@ -459,16 +459,16 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); assertEquals(0, embeddedMapping.specifiedAttributeOverridesSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertEquals(2, embeddedMapping.specifiedAttributeOverridesSize()); @@ -480,21 +480,21 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); assertEquals(2, embeddedMapping.attributeOverridesSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertEquals(4, embeddedMapping.attributeOverridesSize()); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("city"); assertEquals(4, embeddedMapping.attributeOverridesSize()); } @@ -505,23 +505,23 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); assertEquals(2, embeddedMapping.defaultAttributeOverridesSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //add an annotation to the resource model and verify the context model is updated - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); assertEquals(2, embeddedMapping.defaultAttributeOverridesSize()); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("city"); assertEquals(1, embeddedMapping.defaultAttributeOverridesSize()); - attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("state"); assertEquals(0, embeddedMapping.defaultAttributeOverridesSize()); } @@ -532,18 +532,18 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO"); embeddedMapping.addSpecifiedAttributeOverride(0).setName("BAR"); embeddedMapping.addSpecifiedAttributeOverride(0).setName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Iterator<JavaResource> attributeOverrides = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + Iterator<JavaResourceNode> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName()); + assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("BAR", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertFalse(attributeOverrides.hasNext()); } @@ -553,18 +553,18 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO"); embeddedMapping.addSpecifiedAttributeOverride(1).setName("BAR"); embeddedMapping.addSpecifiedAttributeOverride(2).setName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Iterator<JavaResource> attributeOverrides = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + Iterator<JavaResourceNode> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName()); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("BAR", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertFalse(attributeOverrides.hasNext()); } @@ -574,32 +574,32 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO"); embeddedMapping.addSpecifiedAttributeOverride(1).setName("BAR"); embeddedMapping.addSpecifiedAttributeOverride(2).setName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - assertEquals(3, CollectionTools.size(attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME))); embeddedMapping.removeSpecifiedAttributeOverride(1); - Iterator<JavaResource> attributeOverrideResources = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("FOO", ((AttributeOverride) attributeOverrideResources.next()).getName()); - assertEquals("BAZ", ((AttributeOverride) attributeOverrideResources.next()).getName()); + Iterator<JavaResourceNode> attributeOverrideResources = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); + assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); assertFalse(attributeOverrideResources.hasNext()); - Iterator<IAttributeOverride> attributeOverrides = embeddedMapping.specifiedAttributeOverrides(); + Iterator<AttributeOverride> attributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertEquals("FOO", attributeOverrides.next().getName()); assertEquals("BAZ", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); embeddedMapping.removeSpecifiedAttributeOverride(1); - attributeOverrideResources = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("FOO", ((AttributeOverride) attributeOverrideResources.next()).getName()); + attributeOverrideResources = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); assertFalse(attributeOverrideResources.hasNext()); attributeOverrides = embeddedMapping.specifiedAttributeOverrides(); @@ -608,7 +608,7 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase embeddedMapping.removeSpecifiedAttributeOverride(0); - attributeOverrideResources = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + attributeOverrideResources = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); assertFalse(attributeOverrideResources.hasNext()); attributeOverrides = embeddedMapping.specifiedAttributeOverrides(); assertFalse(attributeOverrides.hasNext()); @@ -622,21 +622,21 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); embeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO"); embeddedMapping.addSpecifiedAttributeOverride(1).setName("BAR"); embeddedMapping.addSpecifiedAttributeOverride(2).setName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); attributeResource.move(2, 0, AttributeOverrides.ANNOTATION_NAME); - Iterator<JavaResource> attributeOverrides = attributeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + Iterator<JavaResourceNode> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName()); + assertEquals("BAR", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); } public void testAttributeOverrideIsVirtual() throws Exception { @@ -645,9 +645,9 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); - ListIterator<IAttributeOverride> defaultAttributeOverrides = embeddedMapping.defaultAttributeOverrides(); - IAttributeOverride defaultAttributeOverride = defaultAttributeOverrides.next(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) javaPersistentType().attributeNamed("myEmbedded").getMapping(); + ListIterator<AttributeOverride> defaultAttributeOverrides = embeddedMapping.defaultAttributeOverrides(); + AttributeOverride defaultAttributeOverride = defaultAttributeOverrides.next(); assertEquals("city", defaultAttributeOverride.getName()); assertTrue(defaultAttributeOverride.isVirtual()); @@ -657,7 +657,7 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase assertFalse(defaultAttributeOverrides.hasNext()); embeddedMapping.addSpecifiedAttributeOverride(0).setName("state"); - IAttributeOverride specifiedAttributeOverride = embeddedMapping.specifiedAttributeOverrides().next(); + AttributeOverride specifiedAttributeOverride = embeddedMapping.specifiedAttributeOverrides().next(); assertFalse(specifiedAttributeOverride.isVirtual()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java index 90ef54541f..defc48b58c 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaEntityTests.java @@ -13,59 +13,59 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.AccessType; -import org.eclipse.jpt.core.internal.context.base.DiscriminatorType; -import org.eclipse.jpt.core.internal.context.base.IAssociationOverride; -import org.eclipse.jpt.core.internal.context.base.IAttributeOverride; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddable; -import org.eclipse.jpt.core.internal.context.base.IEntity; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass; -import org.eclipse.jpt.core.internal.context.base.INamedNativeQuery; -import org.eclipse.jpt.core.internal.context.base.INamedQuery; -import org.eclipse.jpt.core.internal.context.base.IPersistentType; -import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.context.base.ISecondaryTable; -import org.eclipse.jpt.core.internal.context.base.ITable; -import org.eclipse.jpt.core.internal.context.base.InheritanceType; -import org.eclipse.jpt.core.internal.context.java.IJavaAssociationOverride; -import org.eclipse.jpt.core.internal.context.java.IJavaAttributeOverride; -import org.eclipse.jpt.core.internal.context.java.IJavaEntity; -import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType; -import org.eclipse.jpt.core.internal.context.java.IJavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.context.java.IJavaSecondaryTable; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.AccessType; +import org.eclipse.jpt.core.context.AssociationOverride; +import org.eclipse.jpt.core.context.AttributeOverride; +import org.eclipse.jpt.core.context.DiscriminatorType; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.Embeddable; +import org.eclipse.jpt.core.context.Entity; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.MappedSuperclass; +import org.eclipse.jpt.core.context.NamedNativeQuery; +import org.eclipse.jpt.core.context.NamedQuery; +import org.eclipse.jpt.core.context.PersistentType; +import org.eclipse.jpt.core.context.InheritanceType; +import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn; +import org.eclipse.jpt.core.context.SecondaryTable; +import org.eclipse.jpt.core.context.Table; +import org.eclipse.jpt.core.context.java.JavaEntity; +import org.eclipse.jpt.core.context.java.JavaPersistentType; +import org.eclipse.jpt.core.context.java.JavaAssociationOverride; +import org.eclipse.jpt.core.context.java.JavaAttributeOverride; +import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn; +import org.eclipse.jpt.core.context.java.JavaSecondaryTable; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.context.persistence.ClassRef; import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.persistence.IClassRef; -import org.eclipse.jpt.core.internal.resource.java.AssociationOverride; -import org.eclipse.jpt.core.internal.resource.java.AssociationOverrides; -import org.eclipse.jpt.core.internal.resource.java.AttributeOverride; -import org.eclipse.jpt.core.internal.resource.java.AttributeOverrides; -import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumn; -import org.eclipse.jpt.core.internal.resource.java.DiscriminatorValue; -import org.eclipse.jpt.core.internal.resource.java.Entity; -import org.eclipse.jpt.core.internal.resource.java.IdClass; -import org.eclipse.jpt.core.internal.resource.java.Inheritance; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueries; -import org.eclipse.jpt.core.internal.resource.java.NamedNativeQuery; -import org.eclipse.jpt.core.internal.resource.java.NamedQueries; -import org.eclipse.jpt.core.internal.resource.java.NamedQuery; -import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumns; -import org.eclipse.jpt.core.internal.resource.java.SecondaryTable; -import org.eclipse.jpt.core.internal.resource.java.SecondaryTables; -import org.eclipse.jpt.core.internal.resource.java.SequenceGenerator; -import org.eclipse.jpt.core.internal.resource.java.Table; -import org.eclipse.jpt.core.internal.resource.java.TableGenerator; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.AssociationOverrides; +import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.AttributeOverrides; +import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation; +import org.eclipse.jpt.core.resource.java.DiscriminatorValue; +import org.eclipse.jpt.core.resource.java.EntityAnnotation; +import org.eclipse.jpt.core.resource.java.IdClass; +import org.eclipse.jpt.core.resource.java.Inheritance; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.NamedNativeQueries; +import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation; +import org.eclipse.jpt.core.resource.java.NamedQueries; +import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumns; +import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation; +import org.eclipse.jpt.core.resource.java.SecondaryTables; +import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation; +import org.eclipse.jpt.core.resource.java.TableAnnotation; +import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.CollectionTools; @@ -344,7 +344,7 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = (IEntity) javaPersistentType().getMapping(); + Entity entity = (Entity) javaPersistentType().getMapping(); entity.getTable().setSpecifiedName("FOO"); entity.addSpecifiedSecondaryTable(0); entity.addSpecifiedPrimaryKeyJoinColumn(0); @@ -359,31 +359,31 @@ public class JavaEntityTests extends ContextModelTestCase entity.addNamedNativeQuery(0); entity.addNamedQuery(0); - javaPersistentType().setMappingKey(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); - assertTrue(javaPersistentType().getMapping() instanceof IMappedSuperclass); + javaPersistentType().setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); + assertTrue(javaPersistentType().getMapping() instanceof MappedSuperclass); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.mappingAnnotation(Entity.ANNOTATION_NAME)); - assertNull(typeResource.annotation(Table.ANNOTATION_NAME)); - assertNull(typeResource.annotation(SecondaryTable.ANNOTATION_NAME)); - assertNull(typeResource.annotation(PrimaryKeyJoinColumn.ANNOTATION_NAME)); - assertNull(typeResource.annotation(AttributeOverride.ANNOTATION_NAME)); - assertNull(typeResource.annotation(AssociationOverride.ANNOTATION_NAME)); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + assertNull(typeResource.mappingAnnotation(EntityAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(TableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(SecondaryTableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); assertNull(typeResource.annotation(Inheritance.ANNOTATION_NAME)); assertNull(typeResource.annotation(DiscriminatorValue.ANNOTATION_NAME)); - assertNull(typeResource.annotation(DiscriminatorColumn.ANNOTATION_NAME)); - assertNull(typeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(typeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); + assertNull(typeResource.annotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); assertNotNull(typeResource.annotation(IdClass.ANNOTATION_NAME)); - assertNull(typeResource.annotation(NamedQuery.ANNOTATION_NAME)); - assertNull(typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME)); + assertNull(typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddable() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = (IEntity) javaPersistentType().getMapping(); + Entity entity = (Entity) javaPersistentType().getMapping(); entity.getTable().setSpecifiedName("FOO"); entity.addSpecifiedSecondaryTable(0); entity.addSpecifiedPrimaryKeyJoinColumn(0); @@ -398,31 +398,31 @@ public class JavaEntityTests extends ContextModelTestCase entity.addNamedNativeQuery(0); entity.addNamedQuery(0); - javaPersistentType().setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); - assertTrue(javaPersistentType().getMapping() instanceof IEmbeddable); + javaPersistentType().setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); + assertTrue(javaPersistentType().getMapping() instanceof Embeddable); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.mappingAnnotation(Entity.ANNOTATION_NAME)); - assertNull(typeResource.annotation(Table.ANNOTATION_NAME)); - assertNull(typeResource.annotation(SecondaryTable.ANNOTATION_NAME)); - assertNull(typeResource.annotation(PrimaryKeyJoinColumn.ANNOTATION_NAME)); - assertNull(typeResource.annotation(AttributeOverride.ANNOTATION_NAME)); - assertNull(typeResource.annotation(AssociationOverride.ANNOTATION_NAME)); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + assertNull(typeResource.mappingAnnotation(EntityAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(TableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(SecondaryTableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); assertNull(typeResource.annotation(Inheritance.ANNOTATION_NAME)); assertNull(typeResource.annotation(DiscriminatorValue.ANNOTATION_NAME)); - assertNull(typeResource.annotation(DiscriminatorColumn.ANNOTATION_NAME)); - assertNull(typeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(typeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); + assertNull(typeResource.annotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME)); - assertNull(typeResource.annotation(NamedQuery.ANNOTATION_NAME)); - assertNull(typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME)); + assertNull(typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME)); } public void testMorphToNull() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = (IEntity) javaPersistentType().getMapping(); + Entity entity = (Entity) javaPersistentType().getMapping(); entity.getTable().setSpecifiedName("FOO"); entity.addSpecifiedSecondaryTable(0); entity.addSpecifiedPrimaryKeyJoinColumn(0); @@ -437,24 +437,24 @@ public class JavaEntityTests extends ContextModelTestCase entity.addNamedNativeQuery(0); entity.addNamedQuery(0); - javaPersistentType().setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY); + javaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY); assertTrue(javaPersistentType().getMapping() instanceof JavaNullTypeMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.mappingAnnotation(Entity.ANNOTATION_NAME)); - assertNull(typeResource.annotation(Table.ANNOTATION_NAME)); - assertNull(typeResource.annotation(SecondaryTable.ANNOTATION_NAME)); - assertNull(typeResource.annotation(PrimaryKeyJoinColumn.ANNOTATION_NAME)); - assertNull(typeResource.annotation(AttributeOverride.ANNOTATION_NAME)); - assertNull(typeResource.annotation(AssociationOverride.ANNOTATION_NAME)); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + assertNull(typeResource.mappingAnnotation(EntityAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(TableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(SecondaryTableAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); assertNull(typeResource.annotation(Inheritance.ANNOTATION_NAME)); assertNull(typeResource.annotation(DiscriminatorValue.ANNOTATION_NAME)); - assertNull(typeResource.annotation(DiscriminatorColumn.ANNOTATION_NAME)); - assertNull(typeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(typeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); + assertNull(typeResource.annotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME)); - assertNull(typeResource.annotation(NamedQuery.ANNOTATION_NAME)); - assertNull(typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME)); + assertNull(typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME)); + assertNull(typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME)); } public void testAccessNoAnnotations() throws Exception { @@ -472,20 +472,20 @@ public class JavaEntityTests extends ContextModelTestCase mappingFileRef.setFileName(JptCorePlugin.DEFAULT_ORM_XML_FILE_PATH); xmlPersistenceUnit().getMappingFiles().add(mappingFileRef); - IJavaPersistentType childPersistentType = javaPersistentType(); - IPersistentType parentPersistentType = childPersistentType.parentPersistentType(); + JavaPersistentType childPersistentType = javaPersistentType(); + PersistentType parentPersistentType = childPersistentType.parentPersistentType(); assertEquals(AccessType.PROPERTY, parentPersistentType.access()); assertEquals(AccessType.PROPERTY, childPersistentType.access()); - ((IIdMapping) parentPersistentType.attributeNamed("id").getMapping()).getColumn().setSpecifiedName("FOO"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + ((IdMapping) parentPersistentType.attributeNamed("id").getMapping()).getColumn().setSpecifiedName("FOO"); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); typeResource.properties().next().setMappingAnnotation(null); //no mapping(Id) annotation, but still a Column annotation, so access should still be property assertEquals(AccessType.PROPERTY, parentPersistentType.access()); assertEquals(AccessType.PROPERTY, childPersistentType.access()); - ((IBasicMapping) parentPersistentType.attributeNamed("id").getMapping()).getColumn().setSpecifiedName(null); + ((BasicMapping) parentPersistentType.attributeNamed("id").getMapping()).getColumn().setSpecifiedName(null); assertEquals(AccessType.FIELD, parentPersistentType.access()); assertEquals(AccessType.FIELD, childPersistentType.access()); @@ -498,17 +498,17 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(AccessType.PROPERTY, parentPersistentType.access()); assertEquals(AccessType.PROPERTY, childPersistentType.access()); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); removeXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); //only parent specified in orm.xml, i think this outcome is right?? - assertEquals(AccessType.FIELD, xmlPersistentType.javaPersistentType().access()); + assertEquals(AccessType.FIELD, ormPersistentType.javaPersistentType().access()); assertEquals(AccessType.FIELD, childPersistentType.access()); - XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); + OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); removeXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); //both parent and child specified in orm.xml - assertEquals(AccessType.FIELD, xmlPersistentType.javaPersistentType().access()); - assertEquals(AccessType.FIELD, childXmlPersistentType.javaPersistentType().access()); + assertEquals(AccessType.FIELD, ormPersistentType.javaPersistentType().access()); + assertEquals(AccessType.FIELD, childOrmPersistentType.javaPersistentType().access()); } public void testAccessWithXmlSettings() throws Exception { @@ -520,13 +520,13 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(AccessType.PROPERTY, javaPersistentType().access()); - ((IIdMapping) javaPersistentType().attributeNamed("id").getMapping()).getColumn().setSpecifiedName("FOO"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + ((IdMapping) javaPersistentType().attributeNamed("id").getMapping()).getColumn().setSpecifiedName("FOO"); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); typeResource.properties().next().setMappingAnnotation(null); //no mapping(Id) annotation, but still a Column annotation, so access should still be property assertEquals(AccessType.PROPERTY, javaPersistentType().access()); - ((IBasicMapping) javaPersistentType().attributeNamed("id").getMapping()).getColumn().setSpecifiedName(null); + ((BasicMapping) javaPersistentType().attributeNamed("id").getMapping()).getColumn().setSpecifiedName(null); assertEquals(AccessType.FIELD, javaPersistentType().access()); entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY); @@ -536,15 +536,15 @@ public class JavaEntityTests extends ContextModelTestCase //still accessType of PROPERTY because the java class is not specified in this orm.xml assertEquals(AccessType.PROPERTY, javaPersistentType().access()); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); //now class is specified in orm.xml, so entityMappings access setting wins over persistence-unit-defaults - assertEquals(AccessType.FIELD, xmlPersistentType.javaPersistentType().access()); + assertEquals(AccessType.FIELD, ormPersistentType.javaPersistentType().access()); - ((XmlEntity) xmlPersistentType.getMapping()).setSpecifiedAccess(AccessType.PROPERTY); + ((GenericOrmEntity) ormPersistentType.getMapping()).setSpecifiedAccess(AccessType.PROPERTY); //accessType should be PROPERTY now, java gets the access from xml entity if it is specified - assertEquals(AccessType.PROPERTY, xmlPersistentType.javaPersistentType().access()); + assertEquals(AccessType.PROPERTY, ormPersistentType.javaPersistentType().access()); } public void testGetSpecifiedNameNull() throws Exception { @@ -597,9 +597,9 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("foo", javaEntity().getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertEquals("foo", ((Entity) typeResource.mappingAnnotation()).getName()); + assertEquals("foo", ((EntityAnnotation) typeResource.mappingAnnotation()).getName()); } public void testSetSpecifiedNameNull() throws Exception { @@ -610,17 +610,17 @@ public class JavaEntityTests extends ContextModelTestCase assertNull(javaEntity().getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertNull(((Entity) typeResource.mappingAnnotation()).getName()); + assertNull(((EntityAnnotation) typeResource.mappingAnnotation()).getName()); } public void testUpdateFromSpecifiedNameChangeInResourceModel() throws Exception { createTestEntityWithName(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Entity entity = (Entity) typeResource.mappingAnnotation(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + EntityAnnotation entity = (EntityAnnotation) typeResource.mappingAnnotation(); entity.setName("foo"); assertEquals("foo", javaEntity().getSpecifiedName()); @@ -651,7 +651,7 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ITable table = javaEntity().getTable(); + Table table = javaEntity().getTable(); assertEquals(TYPE_NAME, table.getName()); assertSourceDoesNotContain("@Table"); @@ -696,10 +696,10 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(InheritanceType.TABLE_PER_CLASS, javaEntity().getSpecifiedInheritanceStrategy()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); Inheritance inheritance = (Inheritance) typeResource.annotation(Inheritance.ANNOTATION_NAME); - inheritance.setStrategy(org.eclipse.jpt.core.internal.resource.java.InheritanceType.JOINED); + inheritance.setStrategy(org.eclipse.jpt.core.resource.java.InheritanceType.JOINED); assertEquals(InheritanceType.JOINED, javaEntity().getSpecifiedInheritanceStrategy()); @@ -717,9 +717,9 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(InheritanceType.JOINED, javaEntity().getSpecifiedInheritanceStrategy()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); Inheritance inheritance = (Inheritance) typeResource.annotation(Inheritance.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.core.internal.resource.java.InheritanceType.JOINED, inheritance.getStrategy()); + assertEquals(org.eclipse.jpt.core.resource.java.InheritanceType.JOINED, inheritance.getStrategy()); } @@ -746,7 +746,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(DISCRIMINATOR_VALUE, javaEntity().getSpecifiedDiscriminatorValue()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); DiscriminatorValue discriminatorValue = (DiscriminatorValue) typeResource.annotation(DiscriminatorValue.ANNOTATION_NAME); discriminatorValue.setValue("foo"); @@ -768,7 +768,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("foo", javaEntity().getSpecifiedDiscriminatorValue()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); DiscriminatorValue discriminatorValue = (DiscriminatorValue) typeResource.annotation(DiscriminatorValue.ANNOTATION_NAME); assertEquals("foo", discriminatorValue.getValue()); } @@ -777,7 +777,7 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<IJavaSecondaryTable> secondaryTables = javaEntity().secondaryTables(); + ListIterator<JavaSecondaryTable> secondaryTables = javaEntity().secondaryTables(); assertTrue(secondaryTables.hasNext()); assertEquals("foo", secondaryTables.next().getName()); @@ -788,14 +788,14 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); assertEquals(0, entity.secondaryTablesSize()); - ((SecondaryTable) typeResource.addAnnotation(0, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("FOO"); - ((SecondaryTable) typeResource.addAnnotation(1, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAR"); - ((SecondaryTable) typeResource.addAnnotation(2, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAZ"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("FOO"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAR"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAZ"); assertEquals(3, entity.secondaryTablesSize()); } @@ -804,7 +804,7 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntityWithSecondaryTables(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<IJavaSecondaryTable> specifiedSecondaryTables = javaEntity().specifiedSecondaryTables(); + ListIterator<JavaSecondaryTable> specifiedSecondaryTables = javaEntity().specifiedSecondaryTables(); assertTrue(specifiedSecondaryTables.hasNext()); assertEquals("foo", specifiedSecondaryTables.next().getName()); @@ -816,14 +816,14 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); assertEquals(0, entity.specifiedSecondaryTablesSize()); - ((SecondaryTable) typeResource.addAnnotation(0, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("FOO"); - ((SecondaryTable) typeResource.addAnnotation(1, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAR"); - ((SecondaryTable) typeResource.addAnnotation(2, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAZ"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("FOO"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAR"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAZ"); assertEquals(3, entity.specifiedSecondaryTablesSize()); } @@ -836,12 +836,12 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAR"); javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Iterator<JavaResource> secondaryTables = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Iterator<JavaResourceNode> secondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); - assertEquals("BAZ", ((SecondaryTable) secondaryTables.next()).getName()); - assertEquals("BAR", ((SecondaryTable) secondaryTables.next()).getName()); - assertEquals("FOO", ((SecondaryTable) secondaryTables.next()).getName()); + assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); + assertEquals("BAR", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); + assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); assertFalse(secondaryTables.hasNext()); } @@ -853,12 +853,12 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().addSpecifiedSecondaryTable(1).setSpecifiedName("BAR"); javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Iterator<JavaResource> secondaryTables = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Iterator<JavaResourceNode> secondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); - assertEquals("BAZ", ((SecondaryTable) secondaryTables.next()).getName()); - assertEquals("FOO", ((SecondaryTable) secondaryTables.next()).getName()); - assertEquals("BAR", ((SecondaryTable) secondaryTables.next()).getName()); + assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); + assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); + assertEquals("BAR", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); assertFalse(secondaryTables.hasNext()); } @@ -866,25 +866,25 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable specifiedSecondaryTable = javaEntity().addSpecifiedSecondaryTable(0); + SecondaryTable specifiedSecondaryTable = javaEntity().addSpecifiedSecondaryTable(0); specifiedSecondaryTable.setSpecifiedName("FOO"); specifiedSecondaryTable.setSpecifiedCatalog("CATALOG"); specifiedSecondaryTable.setSpecifiedSchema("SCHEMA"); specifiedSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("PK_NAME"); //add another specified secondary table, pkJoinColumns from first should be saved. - ISecondaryTable specifiedSecondaryTable2 = javaEntity().addSpecifiedSecondaryTable(1); + SecondaryTable specifiedSecondaryTable2 = javaEntity().addSpecifiedSecondaryTable(1); specifiedSecondaryTable2.setSpecifiedName("BAR"); - Iterator<ISecondaryTable> secondaryTables = javaEntity().secondaryTables(); - ISecondaryTable secondaryTable = secondaryTables.next(); + Iterator<SecondaryTable> secondaryTables = javaEntity().secondaryTables(); + SecondaryTable secondaryTable = secondaryTables.next(); assertEquals(secondaryTable, specifiedSecondaryTable); assertEquals("FOO", secondaryTable.getName()); assertEquals("CATALOG", secondaryTable.getCatalog()); assertEquals("SCHEMA", secondaryTable.getSchema()); assertEquals(1, secondaryTable.specifiedPrimaryKeyJoinColumnsSize()); - IPrimaryKeyJoinColumn pkJoinColumn = secondaryTable.specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn pkJoinColumn = secondaryTable.specifiedPrimaryKeyJoinColumns().next(); assertEquals("PK_NAME", pkJoinColumn.getName()); secondaryTable = secondaryTables.next(); @@ -902,26 +902,26 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().addSpecifiedSecondaryTable(1).setSpecifiedName("BAR"); javaEntity().addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(3, CollectionTools.size(typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME))); javaEntity().removeSpecifiedSecondaryTable(1); - Iterator<JavaResource> secondaryTableResources = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); - assertEquals("FOO", ((SecondaryTable) secondaryTableResources.next()).getName()); - assertEquals("BAZ", ((SecondaryTable) secondaryTableResources.next()).getName()); + Iterator<JavaResourceNode> secondaryTableResources = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); + assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTableResources.next()).getName()); + assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTableResources.next()).getName()); assertFalse(secondaryTableResources.hasNext()); - Iterator<ISecondaryTable> secondaryTables = javaEntity().secondaryTables(); + Iterator<SecondaryTable> secondaryTables = javaEntity().secondaryTables(); assertEquals("FOO", secondaryTables.next().getName()); assertEquals("BAZ", secondaryTables.next().getName()); assertFalse(secondaryTables.hasNext()); javaEntity().removeSpecifiedSecondaryTable(1); - secondaryTableResources = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); - assertEquals("FOO", ((SecondaryTable) secondaryTableResources.next()).getName()); + secondaryTableResources = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); + assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTableResources.next()).getName()); assertFalse(secondaryTableResources.hasNext()); secondaryTables = javaEntity().secondaryTables(); @@ -930,7 +930,7 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().removeSpecifiedSecondaryTable(0); - secondaryTableResources = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); + secondaryTableResources = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); assertFalse(secondaryTableResources.hasNext()); secondaryTables = javaEntity().secondaryTables(); assertFalse(secondaryTables.hasNext()); @@ -942,24 +942,24 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); entity.addSpecifiedSecondaryTable(0).setSpecifiedName("FOO"); entity.addSpecifiedSecondaryTable(1).setSpecifiedName("BAR"); entity.addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ"); - ListIterator<SecondaryTable> javaSecondaryTables = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); + ListIterator<SecondaryTableAnnotation> javaSecondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaSecondaryTables)); entity.moveSpecifiedSecondaryTable(2, 0); - ListIterator<ISecondaryTable> secondaryTables = entity.specifiedSecondaryTables(); + ListIterator<SecondaryTable> secondaryTables = entity.specifiedSecondaryTables(); assertEquals("BAR", secondaryTables.next().getSpecifiedName()); assertEquals("BAZ", secondaryTables.next().getSpecifiedName()); assertEquals("FOO", secondaryTables.next().getSpecifiedName()); - javaSecondaryTables = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); + javaSecondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); assertEquals("BAR", javaSecondaryTables.next().getName()); assertEquals("BAZ", javaSecondaryTables.next().getName()); assertEquals("FOO", javaSecondaryTables.next().getName()); @@ -971,7 +971,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAR", secondaryTables.next().getSpecifiedName()); assertEquals("FOO", secondaryTables.next().getSpecifiedName()); - javaSecondaryTables = typeResource.annotations(SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); + javaSecondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); assertEquals("BAZ", javaSecondaryTables.next().getName()); assertEquals("BAR", javaSecondaryTables.next().getName()); assertEquals("FOO", javaSecondaryTables.next().getName()); @@ -981,14 +981,14 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - ((SecondaryTable) typeResource.addAnnotation(0, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("FOO"); - ((SecondaryTable) typeResource.addAnnotation(1, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAR"); - ((SecondaryTable) typeResource.addAnnotation(2, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAZ"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("FOO"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAR"); + ((SecondaryTableAnnotation) typeResource.addAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME)).setName("BAZ"); - ListIterator<ISecondaryTable> secondaryTables = entity.specifiedSecondaryTables(); + ListIterator<SecondaryTable> secondaryTables = entity.specifiedSecondaryTables(); assertEquals("FOO", secondaryTables.next().getName()); assertEquals("BAR", secondaryTables.next().getName()); assertEquals("BAZ", secondaryTables.next().getName()); @@ -1008,18 +1008,18 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("FOO", secondaryTables.next().getName()); assertFalse(secondaryTables.hasNext()); - typeResource.removeAnnotation(1, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); + typeResource.removeAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); secondaryTables = entity.specifiedSecondaryTables(); assertEquals("BAZ", secondaryTables.next().getName()); assertEquals("FOO", secondaryTables.next().getName()); assertFalse(secondaryTables.hasNext()); - typeResource.removeAnnotation(1, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); + typeResource.removeAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); secondaryTables = entity.specifiedSecondaryTables(); assertEquals("BAZ", secondaryTables.next().getName()); assertFalse(secondaryTables.hasNext()); - typeResource.removeAnnotation(0, SecondaryTable.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); + typeResource.removeAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTables.ANNOTATION_NAME); secondaryTables = entity.specifiedSecondaryTables(); assertFalse(secondaryTables.hasNext()); } @@ -1029,10 +1029,10 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); assertEquals(3, CollectionTools.size(javaEntity().associatedTables())); - Iterator<ITable> associatedTables = javaEntity().associatedTables(); - ITable table1 = associatedTables.next(); - ISecondaryTable table2 = (ISecondaryTable) associatedTables.next(); - ISecondaryTable table3 = (ISecondaryTable) associatedTables.next(); + Iterator<Table> associatedTables = javaEntity().associatedTables(); + Table table1 = associatedTables.next(); + SecondaryTable table2 = (SecondaryTable) associatedTables.next(); + SecondaryTable table3 = (SecondaryTable) associatedTables.next(); assertEquals(TYPE_NAME, table1.getName()); assertEquals("foo", table2.getName()); assertEquals("bar", table3.getName()); @@ -1044,17 +1044,17 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity parentEntity = javaEntity().rootEntity(); + Entity parentEntity = javaEntity().rootEntity(); assertEquals(3, CollectionTools.size(parentEntity.associatedTablesIncludingInherited())); - Iterator<ITable> associatedTables = parentEntity.associatedTablesIncludingInherited(); - ITable table1 = associatedTables.next(); - ISecondaryTable table2 = (ISecondaryTable) associatedTables.next(); - ISecondaryTable table3 = (ISecondaryTable) associatedTables.next(); + Iterator<Table> associatedTables = parentEntity.associatedTablesIncludingInherited(); + Table table1 = associatedTables.next(); + SecondaryTable table2 = (SecondaryTable) associatedTables.next(); + SecondaryTable table3 = (SecondaryTable) associatedTables.next(); assertEquals(TYPE_NAME, table1.getName()); assertEquals("foo", table2.getName()); assertEquals("bar", table3.getName()); - IEntity childEntity = javaEntity(); + Entity childEntity = javaEntity(); //TODO probably want this to be 3, since in this case the child descriptor really uses the //parent table because it is single table inheritance strategy. Not sure yet how to deal with this. assertEquals(4, CollectionTools.size(childEntity.associatedTablesIncludingInherited())); @@ -1066,7 +1066,7 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity parentEntity = javaEntity().rootEntity(); + Entity parentEntity = javaEntity().rootEntity(); assertEquals(3, CollectionTools.size(parentEntity.associatedTableNamesIncludingInherited())); Iterator<String> associatedTables = parentEntity.associatedTableNamesIncludingInherited(); String table1 = associatedTables.next(); @@ -1076,7 +1076,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("foo", table2); assertEquals("bar", table3); - IEntity childEntity = javaEntity(); + Entity childEntity = javaEntity(); //TODO probably want this to be 3, since in this case the child descriptor really uses the //parent table because it is single table inheritance strategy. Not sure yet how to deal with this. assertEquals(4, CollectionTools.size(childEntity.associatedTableNamesIncludingInherited())); @@ -1086,23 +1086,23 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntityWithName(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTable secondaryTable = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable.setName("FOO"); assertEquals(1, javaEntity().secondaryTablesSize()); assertEquals("FOO", javaEntity().secondaryTables().next().getSpecifiedName()); assertEquals("FOO", javaEntity().secondaryTables().next().getName()); - SecondaryTable secondaryTable2 = (SecondaryTable) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTable2 = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable2.setName("BAR"); assertEquals(2, javaEntity().secondaryTablesSize()); - ListIterator<ISecondaryTable> secondaryTables = javaEntity().secondaryTables(); + ListIterator<SecondaryTable> secondaryTables = javaEntity().secondaryTables(); assertEquals("FOO", secondaryTables.next().getSpecifiedName()); assertEquals("BAR", secondaryTables.next().getSpecifiedName()); - SecondaryTable secondaryTable3 = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTable3 = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable3.setName("BAZ"); assertEquals(3, javaEntity().secondaryTablesSize()); @@ -1117,14 +1117,14 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); javaEntity().addSpecifiedSecondaryTable(2).setSpecifiedName("baz"); - ListIterator<ISecondaryTable> secondaryTables = javaEntity().secondaryTables(); + ListIterator<SecondaryTable> secondaryTables = javaEntity().secondaryTables(); assertEquals(3, javaEntity().secondaryTablesSize()); assertEquals("foo", secondaryTables.next().getSpecifiedName()); assertEquals("bar", secondaryTables.next().getSpecifiedName()); assertEquals("baz", secondaryTables.next().getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTables = javaEntity().secondaryTables(); @@ -1152,7 +1152,7 @@ public class JavaEntityTests extends ContextModelTestCase assertNull(javaEntity().getSequenceGenerator()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); typeResource.addAnnotation(JPA.SEQUENCE_GENERATOR); assertNotNull(javaEntity().getSequenceGenerator()); @@ -1167,7 +1167,7 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().addSequenceGenerator(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); assertNotNull(typeResource.annotation(JPA.SEQUENCE_GENERATOR)); assertNotNull(javaEntity().getSequenceGenerator()); @@ -1185,7 +1185,7 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); typeResource.addAnnotation(JPA.SEQUENCE_GENERATOR); javaEntity().removeSequenceGenerator(); @@ -1208,7 +1208,7 @@ public class JavaEntityTests extends ContextModelTestCase assertNull(javaEntity().getTableGenerator()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); typeResource.addAnnotation(JPA.TABLE_GENERATOR); assertNotNull(javaEntity().getTableGenerator()); @@ -1223,7 +1223,7 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().addTableGenerator(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); assertNotNull(typeResource.annotation(JPA.TABLE_GENERATOR)); assertNotNull(javaEntity().getTableGenerator()); @@ -1241,7 +1241,7 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); typeResource.addAnnotation(JPA.TABLE_GENERATOR); javaEntity().removeTableGenerator(); @@ -1264,8 +1264,8 @@ public class JavaEntityTests extends ContextModelTestCase assertNotNull(javaEntity().getDiscriminatorColumn()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN); column.setName("foo"); assertEquals("foo", javaEntity().getDiscriminatorColumn().getSpecifiedName()); @@ -1283,20 +1283,20 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<IJavaPrimaryKeyJoinColumn> specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns(); + ListIterator<JavaPrimaryKeyJoinColumn> specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns(); assertFalse(specifiedPkJoinColumns.hasNext()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - PrimaryKeyJoinColumn pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); pkJoinColumn.setName("FOO"); specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns(); assertEquals("FOO", specifiedPkJoinColumns.next().getName()); assertFalse(specifiedPkJoinColumns.hasNext()); - pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); pkJoinColumn.setName("BAR"); specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns(); assertEquals("BAR", specifiedPkJoinColumns.next().getName()); @@ -1304,7 +1304,7 @@ public class JavaEntityTests extends ContextModelTestCase assertFalse(specifiedPkJoinColumns.hasNext()); - pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); pkJoinColumn.setName("BAZ"); specifiedPkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns(); assertEquals("BAZ", specifiedPkJoinColumns.next().getName()); @@ -1386,12 +1386,12 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR"); javaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Iterator<JavaResource> pkJoinColumns = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Iterator<JavaResourceNode> pkJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); - assertEquals("BAZ", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName()); - assertEquals("BAR", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName()); - assertEquals("FOO", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName()); + assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); + assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); + assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); assertFalse(pkJoinColumns.hasNext()); } @@ -1403,12 +1403,12 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR"); javaEntity().addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Iterator<JavaResource> pkJoinColumns = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Iterator<JavaResourceNode> pkJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); - assertEquals("FOO", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName()); - assertEquals("BAR", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName()); - assertEquals("BAZ", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName()); + assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); + assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); + assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); assertFalse(pkJoinColumns.hasNext()); } public void testRemoveSpecifiedPrimaryKeyJoinColumn() throws Exception { @@ -1419,26 +1419,26 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR"); javaEntity().addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(3, CollectionTools.size(typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME))); javaEntity().removeSpecifiedPrimaryKeyJoinColumn(1); - Iterator<JavaResource> pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); - assertEquals("FOO", ((PrimaryKeyJoinColumn) pkJoinColumnResources.next()).getName()); - assertEquals("BAZ", ((PrimaryKeyJoinColumn) pkJoinColumnResources.next()).getName()); + Iterator<JavaResourceNode> pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); + assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumnResources.next()).getName()); + assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumnResources.next()).getName()); assertFalse(pkJoinColumnResources.hasNext()); - Iterator<IPrimaryKeyJoinColumn> pkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns(); + Iterator<PrimaryKeyJoinColumn> pkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns(); assertEquals("FOO", pkJoinColumns.next().getName()); assertEquals("BAZ", pkJoinColumns.next().getName()); assertFalse(pkJoinColumns.hasNext()); javaEntity().removeSpecifiedPrimaryKeyJoinColumn(1); - pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); - assertEquals("FOO", ((PrimaryKeyJoinColumn) pkJoinColumnResources.next()).getName()); + pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); + assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumnResources.next()).getName()); assertFalse(pkJoinColumnResources.hasNext()); pkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns(); @@ -1447,7 +1447,7 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().removeSpecifiedPrimaryKeyJoinColumn(0); - pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); + pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); assertFalse(pkJoinColumnResources.hasNext()); pkJoinColumns = javaEntity().specifiedPrimaryKeyJoinColumns(); assertFalse(pkJoinColumns.hasNext()); @@ -1459,24 +1459,24 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); entity.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO"); entity.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR"); entity.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ"); - ListIterator<PrimaryKeyJoinColumn> javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); + ListIterator<PrimaryKeyJoinColumnAnnotation> javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaPrimaryKeyJoinColumns)); entity.moveSpecifiedPrimaryKeyJoinColumn(2, 0); - ListIterator<IPrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); + ListIterator<PrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); + javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); assertEquals("BAR", javaPrimaryKeyJoinColumns.next().getName()); assertEquals("BAZ", javaPrimaryKeyJoinColumns.next().getName()); assertEquals("FOO", javaPrimaryKeyJoinColumns.next().getName()); @@ -1488,7 +1488,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); + javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); assertEquals("BAZ", javaPrimaryKeyJoinColumns.next().getName()); assertEquals("BAR", javaPrimaryKeyJoinColumns.next().getName()); assertEquals("FOO", javaPrimaryKeyJoinColumns.next().getName()); @@ -1498,14 +1498,14 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - ((PrimaryKeyJoinColumn) typeResource.addAnnotation(0, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME)).setName("FOO"); - ((PrimaryKeyJoinColumn) typeResource.addAnnotation(1, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME)).setName("BAR"); - ((PrimaryKeyJoinColumn) typeResource.addAnnotation(2, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME)).setName("BAZ"); + ((PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME)).setName("FOO"); + ((PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME)).setName("BAR"); + ((PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(2, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME)).setName("BAZ"); - ListIterator<IPrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); + ListIterator<PrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); assertEquals("BAR", primaryKeyJoinColumns.next().getName()); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); @@ -1525,18 +1525,18 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("FOO", primaryKeyJoinColumns.next().getName()); assertFalse(primaryKeyJoinColumns.hasNext()); - typeResource.removeAnnotation(1, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); + typeResource.removeAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); assertFalse(primaryKeyJoinColumns.hasNext()); - typeResource.removeAnnotation(1, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); + typeResource.removeAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); assertFalse(primaryKeyJoinColumns.hasNext()); - typeResource.removeAnnotation(0, PrimaryKeyJoinColumn.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); + typeResource.removeAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumns.ANNOTATION_NAME); primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns(); assertFalse(primaryKeyJoinColumns.hasNext()); } @@ -1548,7 +1548,7 @@ public class JavaEntityTests extends ContextModelTestCase assertTrue(javaEntity().getDefaultPrimaryKeyJoinColumn().isVirtual()); javaEntity().addSpecifiedPrimaryKeyJoinColumn(0); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertFalse(specifiedPkJoinColumn.isVirtual()); assertNull(javaEntity().getDefaultPrimaryKeyJoinColumn()); @@ -1610,37 +1610,37 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = (IEntity) javaPersistentType().getMapping(); - assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY)); - assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY)); - assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY)); - assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)); - assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY)); - assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY)); - assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY)); - assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY)); - assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY)); - assertTrue(entity.attributeMappingKeyAllowed(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY)); + Entity entity = (Entity) javaPersistentType().getMapping(); + assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY)); + assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY)); + assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY)); + assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)); + assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY)); + assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY)); + assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY)); + assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY)); + assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY)); + assertTrue(entity.attributeMappingKeyAllowed(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY)); } public void testSpecifiedAttributeOverrides() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<IJavaAttributeOverride> specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides(); + ListIterator<JavaAttributeOverride> specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides(); assertFalse(specifiedAttributeOverrides.hasNext()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - AttributeOverride attributeOverride = (AttributeOverride) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverride) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides(); assertEquals("FOO", specifiedAttributeOverrides.next().getName()); @@ -1648,7 +1648,7 @@ public class JavaEntityTests extends ContextModelTestCase assertFalse(specifiedAttributeOverrides.hasNext()); - attributeOverride = (AttributeOverride) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAZ"); specifiedAttributeOverrides = javaEntity().specifiedAttributeOverrides(); assertEquals("BAZ", specifiedAttributeOverrides.next().getName()); @@ -1688,30 +1688,30 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IJavaEntity javaEntity = (IJavaEntity) classRefs.next().getJavaPersistentType().getMapping(); + JavaEntity javaEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_SUB_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_SUB_TYPE_NAME); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(typeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); assertNull(typeResource.annotation(AttributeOverrides.ANNOTATION_NAME)); assertEquals(2, javaEntity.defaultAttributeOverridesSize()); - IAttributeOverride defaultAttributeOverride = javaEntity.defaultAttributeOverrides().next(); + AttributeOverride defaultAttributeOverride = javaEntity.defaultAttributeOverrides().next(); assertEquals("id", defaultAttributeOverride.getName()); assertEquals("id", defaultAttributeOverride.getColumn().getName()); assertEquals(SUB_TYPE_NAME, defaultAttributeOverride.getColumn().getTable()); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); - IBasicMapping idMapping = (IBasicMapping) mappedSuperclass.persistentType().attributeNamed("id").getMapping(); + BasicMapping idMapping = (BasicMapping) mappedSuperclass.persistentType().attributeNamed("id").getMapping(); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.getColumn().setSpecifiedTable("BAR"); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(typeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); assertNull(typeResource.annotation(AttributeOverrides.ANNOTATION_NAME)); assertEquals(2, javaEntity.defaultAttributeOverridesSize()); @@ -1723,7 +1723,7 @@ public class JavaEntityTests extends ContextModelTestCase idMapping.getColumn().setSpecifiedName(null); idMapping.getColumn().setSpecifiedTable(null); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.annotation(AttributeOverride.ANNOTATION_NAME)); + assertNull(typeResource.annotation(AttributeOverrideAnnotation.ANNOTATION_NAME)); assertNull(typeResource.annotation(AttributeOverrides.ANNOTATION_NAME)); defaultAttributeOverride = javaEntity.defaultAttributeOverrides().next(); @@ -1741,12 +1741,12 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(0, javaEntity().specifiedAttributeOverridesSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - AttributeOverride attributeOverride = (AttributeOverride) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); - attributeOverride = (AttributeOverride) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertEquals(2, javaEntity().specifiedAttributeOverridesSize()); @@ -1759,9 +1759,9 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME); - ListIterator<IClassRef> classRefs = persistenceUnit().classRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().classRefs(); classRefs.next(); - IJavaEntity javaEntity = (IJavaEntity) classRefs.next().getJavaPersistentType().getMapping(); + JavaEntity javaEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping(); assertEquals(2, javaEntity.defaultAttributeOverridesSize()); @@ -1779,9 +1779,9 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME); - ListIterator<IClassRef> classRefs = persistenceUnit().classRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().classRefs(); classRefs.next(); - IJavaEntity javaEntity = (IJavaEntity) classRefs.next().getJavaPersistentType().getMapping(); + JavaEntity javaEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping(); assertEquals(2, javaEntity.attributeOverridesSize()); @@ -1803,12 +1803,12 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().addSpecifiedAttributeOverride(0).setName("BAR"); javaEntity().addSpecifiedAttributeOverride(0).setName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Iterator<JavaResource> attributeOverrides = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Iterator<JavaResourceNode> attributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName()); + assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("BAR", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertFalse(attributeOverrides.hasNext()); } @@ -1820,12 +1820,12 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().addSpecifiedAttributeOverride(1).setName("BAR"); javaEntity().addSpecifiedAttributeOverride(2).setName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Iterator<JavaResource> attributeOverrides = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Iterator<JavaResourceNode> attributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName()); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("BAR", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertFalse(attributeOverrides.hasNext()); } @@ -1837,26 +1837,26 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().addSpecifiedAttributeOverride(1).setName("BAR"); javaEntity().addSpecifiedAttributeOverride(2).setName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(3, CollectionTools.size(typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME))); javaEntity().removeSpecifiedAttributeOverride(1); - Iterator<JavaResource> attributeOverrideResources = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("FOO", ((AttributeOverride) attributeOverrideResources.next()).getName()); - assertEquals("BAZ", ((AttributeOverride) attributeOverrideResources.next()).getName()); + Iterator<JavaResourceNode> attributeOverrideResources = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); + assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); assertFalse(attributeOverrideResources.hasNext()); - Iterator<IAttributeOverride> attributeOverrides = javaEntity().specifiedAttributeOverrides(); + Iterator<AttributeOverride> attributeOverrides = javaEntity().specifiedAttributeOverrides(); assertEquals("FOO", attributeOverrides.next().getName()); assertEquals("BAZ", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); javaEntity().removeSpecifiedAttributeOverride(1); - attributeOverrideResources = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); - assertEquals("FOO", ((AttributeOverride) attributeOverrideResources.next()).getName()); + attributeOverrideResources = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName()); assertFalse(attributeOverrideResources.hasNext()); attributeOverrides = javaEntity().specifiedAttributeOverrides(); @@ -1865,7 +1865,7 @@ public class JavaEntityTests extends ContextModelTestCase javaEntity().removeSpecifiedAttributeOverride(0); - attributeOverrideResources = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + attributeOverrideResources = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); assertFalse(attributeOverrideResources.hasNext()); attributeOverrides = javaEntity().specifiedAttributeOverrides(); assertFalse(attributeOverrides.hasNext()); @@ -1877,24 +1877,24 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); entity.addSpecifiedAttributeOverride(0).setName("FOO"); entity.addSpecifiedAttributeOverride(1).setName("BAR"); entity.addSpecifiedAttributeOverride(2).setName("BAZ"); - ListIterator<AttributeOverride> javaAttributeOverrides = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + ListIterator<AttributeOverrideAnnotation> javaAttributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaAttributeOverrides)); entity.moveSpecifiedAttributeOverride(2, 0); - ListIterator<IAttributeOverride> attributeOverrides = entity.specifiedAttributeOverrides(); + ListIterator<AttributeOverride> attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("BAR", attributeOverrides.next().getName()); assertEquals("BAZ", attributeOverrides.next().getName()); assertEquals("FOO", attributeOverrides.next().getName()); - javaAttributeOverrides = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + javaAttributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); assertEquals("BAR", javaAttributeOverrides.next().getName()); assertEquals("BAZ", javaAttributeOverrides.next().getName()); assertEquals("FOO", javaAttributeOverrides.next().getName()); @@ -1906,7 +1906,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAR", attributeOverrides.next().getName()); assertEquals("FOO", attributeOverrides.next().getName()); - javaAttributeOverrides = typeResource.annotations(AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + javaAttributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); assertEquals("BAZ", javaAttributeOverrides.next().getName()); assertEquals("BAR", javaAttributeOverrides.next().getName()); assertEquals("FOO", javaAttributeOverrides.next().getName()); @@ -1916,14 +1916,14 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - ((AttributeOverride) typeResource.addAnnotation(0, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME)).setName("FOO"); - ((AttributeOverride) typeResource.addAnnotation(1, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME)).setName("BAR"); - ((AttributeOverride) typeResource.addAnnotation(2, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME)).setName("BAZ"); + ((AttributeOverrideAnnotation) typeResource.addAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME)).setName("FOO"); + ((AttributeOverrideAnnotation) typeResource.addAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME)).setName("BAR"); + ((AttributeOverrideAnnotation) typeResource.addAnnotation(2, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME)).setName("BAZ"); - ListIterator<IAttributeOverride> attributeOverrides = entity.specifiedAttributeOverrides(); + ListIterator<AttributeOverride> attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("FOO", attributeOverrides.next().getName()); assertEquals("BAR", attributeOverrides.next().getName()); assertEquals("BAZ", attributeOverrides.next().getName()); @@ -1943,18 +1943,18 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("FOO", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.removeAnnotation(1, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + typeResource.removeAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("BAZ", attributeOverrides.next().getName()); assertEquals("FOO", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.removeAnnotation(1, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + typeResource.removeAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertEquals("BAZ", attributeOverrides.next().getName()); assertFalse(attributeOverrides.hasNext()); - typeResource.removeAnnotation(0, AttributeOverride.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); + typeResource.removeAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverrides.ANNOTATION_NAME); attributeOverrides = entity.specifiedAttributeOverrides(); assertFalse(attributeOverrides.hasNext()); } @@ -1965,8 +1965,8 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<IAttributeOverride> defaultAttributeOverrides = javaEntity().defaultAttributeOverrides(); - IAttributeOverride defaultAttributeOverride = defaultAttributeOverrides.next(); + ListIterator<AttributeOverride> defaultAttributeOverrides = javaEntity().defaultAttributeOverrides(); + AttributeOverride defaultAttributeOverride = defaultAttributeOverrides.next(); assertEquals("id", defaultAttributeOverride.getName()); assertTrue(defaultAttributeOverride.isVirtual()); @@ -1976,7 +1976,7 @@ public class JavaEntityTests extends ContextModelTestCase assertFalse(defaultAttributeOverrides.hasNext()); javaEntity().addSpecifiedAttributeOverride(0).setName("id"); - IAttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next(); + AttributeOverride specifiedAttributeOverride = javaEntity().specifiedAttributeOverrides().next(); assertFalse(specifiedAttributeOverride.isVirtual()); @@ -1991,31 +1991,31 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - INamedQuery namedQuery = entity.addNamedQuery(0); + NamedQuery namedQuery = entity.addNamedQuery(0); namedQuery.setName("FOO"); - ListIterator<NamedQuery> javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + ListIterator<NamedQueryAnnotation> javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); assertEquals("FOO", javaNamedQueries.next().getName()); - INamedQuery namedQuery2 = entity.addNamedQuery(0); + NamedQuery namedQuery2 = entity.addNamedQuery(0); namedQuery2.setName("BAR"); - javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); assertEquals("BAR", javaNamedQueries.next().getName()); assertEquals("FOO", javaNamedQueries.next().getName()); - INamedQuery namedQuery3 = entity.addNamedQuery(1); + NamedQuery namedQuery3 = entity.addNamedQuery(1); namedQuery3.setName("BAZ"); - javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); assertEquals("BAR", javaNamedQueries.next().getName()); assertEquals("BAZ", javaNamedQueries.next().getName()); assertEquals("FOO", javaNamedQueries.next().getName()); - ListIterator<INamedQuery> namedQueries = entity.namedQueries(); + ListIterator<NamedQuery> namedQueries = entity.namedQueries(); assertEquals(namedQuery2, namedQueries.next()); assertEquals(namedQuery3, namedQueries.next()); assertEquals(namedQuery, namedQueries.next()); @@ -2030,31 +2030,31 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); entity.addNamedQuery(0).setName("FOO"); entity.addNamedQuery(1).setName("BAR"); entity.addNamedQuery(2).setName("BAZ"); - ListIterator<NamedQuery> javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + ListIterator<NamedQueryAnnotation> javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaNamedQueries)); entity.removeNamedQuery(0); - javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); assertEquals(2, CollectionTools.size(javaNamedQueries)); - javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); assertEquals("BAR", javaNamedQueries.next().getName()); assertEquals("BAZ", javaNamedQueries.next().getName()); entity.removeNamedQuery(0); - javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); assertEquals(1, CollectionTools.size(javaNamedQueries)); - javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); assertEquals("BAZ", javaNamedQueries.next().getName()); entity.removeNamedQuery(0); - javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); assertEquals(0, CollectionTools.size(javaNamedQueries)); } @@ -2062,24 +2062,24 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); entity.addNamedQuery(0).setName("FOO"); entity.addNamedQuery(1).setName("BAR"); entity.addNamedQuery(2).setName("BAZ"); - ListIterator<NamedQuery> javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + ListIterator<NamedQueryAnnotation> javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaNamedQueries)); entity.moveNamedQuery(2, 0); - ListIterator<INamedQuery> namedQueries = entity.namedQueries(); + ListIterator<NamedQuery> namedQueries = entity.namedQueries(); assertEquals("BAR", namedQueries.next().getName()); assertEquals("BAZ", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); - javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); assertEquals("BAR", javaNamedQueries.next().getName()); assertEquals("BAZ", javaNamedQueries.next().getName()); assertEquals("FOO", javaNamedQueries.next().getName()); @@ -2091,7 +2091,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAR", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); - javaNamedQueries = typeResource.annotations(NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); assertEquals("BAZ", javaNamedQueries.next().getName()); assertEquals("BAR", javaNamedQueries.next().getName()); assertEquals("FOO", javaNamedQueries.next().getName()); @@ -2101,14 +2101,14 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - ((NamedQuery) typeResource.addAnnotation(0, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("FOO"); - ((NamedQuery) typeResource.addAnnotation(1, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("BAR"); - ((NamedQuery) typeResource.addAnnotation(2, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("BAZ"); + ((NamedQueryAnnotation) typeResource.addAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("FOO"); + ((NamedQueryAnnotation) typeResource.addAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("BAR"); + ((NamedQueryAnnotation) typeResource.addAnnotation(2, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("BAZ"); - ListIterator<INamedQuery> namedQueries = entity.namedQueries(); + ListIterator<NamedQuery> namedQueries = entity.namedQueries(); assertEquals("FOO", namedQueries.next().getName()); assertEquals("BAR", namedQueries.next().getName()); assertEquals("BAZ", namedQueries.next().getName()); @@ -2128,18 +2128,18 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("FOO", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); - typeResource.removeAnnotation(1, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + typeResource.removeAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); namedQueries = entity.namedQueries(); assertEquals("BAZ", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); - typeResource.removeAnnotation(1, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + typeResource.removeAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); namedQueries = entity.namedQueries(); assertEquals("BAZ", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); - typeResource.removeAnnotation(0, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); + typeResource.removeAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME); namedQueries = entity.namedQueries(); assertFalse(namedQueries.hasNext()); } @@ -2148,14 +2148,14 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); assertEquals(0, entity.namedQueriesSize()); - ((NamedQuery) typeResource.addAnnotation(0, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("FOO"); - ((NamedQuery) typeResource.addAnnotation(1, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("BAR"); - ((NamedQuery) typeResource.addAnnotation(2, NamedQuery.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("BAZ"); + ((NamedQueryAnnotation) typeResource.addAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("FOO"); + ((NamedQueryAnnotation) typeResource.addAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("BAR"); + ((NamedQueryAnnotation) typeResource.addAnnotation(2, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueries.ANNOTATION_NAME)).setName("BAZ"); assertEquals(3, entity.namedQueriesSize()); } @@ -2164,31 +2164,31 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - INamedNativeQuery namedNativeQuery = entity.addNamedNativeQuery(0); + NamedNativeQuery namedNativeQuery = entity.addNamedNativeQuery(0); namedNativeQuery.setName("FOO"); - ListIterator<NamedNativeQuery> javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + ListIterator<NamedNativeQueryAnnotation> javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); assertEquals("FOO", javaNamedQueries.next().getName()); - INamedNativeQuery namedNativeQuery2 = entity.addNamedNativeQuery(0); + NamedNativeQuery namedNativeQuery2 = entity.addNamedNativeQuery(0); namedNativeQuery2.setName("BAR"); - javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); assertEquals("BAR", javaNamedQueries.next().getName()); assertEquals("FOO", javaNamedQueries.next().getName()); - INamedNativeQuery namedNativeQuery3 = entity.addNamedNativeQuery(1); + NamedNativeQuery namedNativeQuery3 = entity.addNamedNativeQuery(1); namedNativeQuery3.setName("BAZ"); - javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); assertEquals("BAR", javaNamedQueries.next().getName()); assertEquals("BAZ", javaNamedQueries.next().getName()); assertEquals("FOO", javaNamedQueries.next().getName()); - ListIterator<INamedNativeQuery> namedQueries = entity.namedNativeQueries(); + ListIterator<NamedNativeQuery> namedQueries = entity.namedNativeQueries(); assertEquals(namedNativeQuery2, namedQueries.next()); assertEquals(namedNativeQuery3, namedQueries.next()); assertEquals(namedNativeQuery, namedQueries.next()); @@ -2203,31 +2203,31 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); entity.addNamedNativeQuery(0).setName("FOO"); entity.addNamedNativeQuery(1).setName("BAR"); entity.addNamedNativeQuery(2).setName("BAZ"); - ListIterator<NamedNativeQuery> javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + ListIterator<NamedNativeQueryAnnotation> javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaNamedQueries)); entity.removeNamedNativeQuery(0); - javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); assertEquals(2, CollectionTools.size(javaNamedQueries)); - javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); assertEquals("BAR", javaNamedQueries.next().getName()); assertEquals("BAZ", javaNamedQueries.next().getName()); entity.removeNamedNativeQuery(0); - javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); assertEquals(1, CollectionTools.size(javaNamedQueries)); - javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); assertEquals("BAZ", javaNamedQueries.next().getName()); entity.removeNamedNativeQuery(0); - javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); assertEquals(0, CollectionTools.size(javaNamedQueries)); } @@ -2235,24 +2235,24 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); entity.addNamedNativeQuery(0).setName("FOO"); entity.addNamedNativeQuery(1).setName("BAR"); entity.addNamedNativeQuery(2).setName("BAZ"); - ListIterator<NamedNativeQuery> javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + ListIterator<NamedNativeQueryAnnotation> javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaNamedQueries)); entity.moveNamedNativeQuery(2, 0); - ListIterator<INamedNativeQuery> namedQueries = entity.namedNativeQueries(); + ListIterator<NamedNativeQuery> namedQueries = entity.namedNativeQueries(); assertEquals("BAR", namedQueries.next().getName()); assertEquals("BAZ", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); - javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); assertEquals("BAR", javaNamedQueries.next().getName()); assertEquals("BAZ", javaNamedQueries.next().getName()); assertEquals("FOO", javaNamedQueries.next().getName()); @@ -2264,7 +2264,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAR", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); - javaNamedQueries = typeResource.annotations(NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); assertEquals("BAZ", javaNamedQueries.next().getName()); assertEquals("BAR", javaNamedQueries.next().getName()); assertEquals("FOO", javaNamedQueries.next().getName()); @@ -2274,14 +2274,14 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - ((NamedNativeQuery) typeResource.addAnnotation(0, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("FOO"); - ((NamedNativeQuery) typeResource.addAnnotation(1, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("BAR"); - ((NamedNativeQuery) typeResource.addAnnotation(2, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("BAZ"); + ((NamedNativeQueryAnnotation) typeResource.addAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("FOO"); + ((NamedNativeQueryAnnotation) typeResource.addAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("BAR"); + ((NamedNativeQueryAnnotation) typeResource.addAnnotation(2, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("BAZ"); - ListIterator<INamedNativeQuery> namedQueries = entity.namedNativeQueries(); + ListIterator<NamedNativeQuery> namedQueries = entity.namedNativeQueries(); assertEquals("FOO", namedQueries.next().getName()); assertEquals("BAR", namedQueries.next().getName()); assertEquals("BAZ", namedQueries.next().getName()); @@ -2301,18 +2301,18 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("FOO", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); - typeResource.removeAnnotation(1, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + typeResource.removeAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); namedQueries = entity.namedNativeQueries(); assertEquals("BAZ", namedQueries.next().getName()); assertEquals("FOO", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); - typeResource.removeAnnotation(1, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + typeResource.removeAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); namedQueries = entity.namedNativeQueries(); assertEquals("BAZ", namedQueries.next().getName()); assertFalse(namedQueries.hasNext()); - typeResource.removeAnnotation(0, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); + typeResource.removeAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME); namedQueries = entity.namedNativeQueries(); assertFalse(namedQueries.hasNext()); } @@ -2321,14 +2321,14 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); assertEquals(0, entity.namedNativeQueriesSize()); - ((NamedNativeQuery) typeResource.addAnnotation(0, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("FOO"); - ((NamedNativeQuery) typeResource.addAnnotation(1, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("BAR"); - ((NamedNativeQuery) typeResource.addAnnotation(2, NamedNativeQuery.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("BAZ"); + ((NamedNativeQueryAnnotation) typeResource.addAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("FOO"); + ((NamedNativeQueryAnnotation) typeResource.addAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("BAR"); + ((NamedNativeQueryAnnotation) typeResource.addAnnotation(2, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueries.ANNOTATION_NAME)).setName("BAZ"); assertEquals(3, entity.namedNativeQueriesSize()); } @@ -2337,31 +2337,31 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - IAssociationOverride associationOverride = entity.addSpecifiedAssociationOverride(0); + AssociationOverride associationOverride = entity.addSpecifiedAssociationOverride(0); associationOverride.setName("FOO"); - ListIterator<AssociationOverride> javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + ListIterator<AssociationOverrideAnnotation> javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); assertEquals("FOO", javaAssociationOverrides.next().getName()); - IAssociationOverride associationOverride2 = entity.addSpecifiedAssociationOverride(0); + AssociationOverride associationOverride2 = entity.addSpecifiedAssociationOverride(0); associationOverride2.setName("BAR"); - javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); assertEquals("BAR", javaAssociationOverrides.next().getName()); assertEquals("FOO", javaAssociationOverrides.next().getName()); - IAssociationOverride associationOverride3 = entity.addSpecifiedAssociationOverride(1); + AssociationOverride associationOverride3 = entity.addSpecifiedAssociationOverride(1); associationOverride3.setName("BAZ"); - javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); assertEquals("BAR", javaAssociationOverrides.next().getName()); assertEquals("BAZ", javaAssociationOverrides.next().getName()); assertEquals("FOO", javaAssociationOverrides.next().getName()); - ListIterator<IAssociationOverride> associationOverrides = entity.specifiedAssociationOverrides(); + ListIterator<AssociationOverride> associationOverrides = entity.specifiedAssociationOverrides(); assertEquals(associationOverride2, associationOverrides.next()); assertEquals(associationOverride3, associationOverrides.next()); assertEquals(associationOverride, associationOverrides.next()); @@ -2376,31 +2376,31 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); entity.addSpecifiedAssociationOverride(0).setName("FOO"); entity.addSpecifiedAssociationOverride(1).setName("BAR"); entity.addSpecifiedAssociationOverride(2).setName("BAZ"); - ListIterator<AssociationOverride> javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + ListIterator<AssociationOverrideAnnotation> javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaAssociationOverrides)); entity.removeSpecifiedAssociationOverride(0); - javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); assertEquals(2, CollectionTools.size(javaAssociationOverrides)); - javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); assertEquals("BAR", javaAssociationOverrides.next().getName()); assertEquals("BAZ", javaAssociationOverrides.next().getName()); entity.removeSpecifiedAssociationOverride(0); - javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); assertEquals(1, CollectionTools.size(javaAssociationOverrides)); - javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); assertEquals("BAZ", javaAssociationOverrides.next().getName()); entity.removeSpecifiedAssociationOverride(0); - javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); assertEquals(0, CollectionTools.size(javaAssociationOverrides)); } @@ -2408,24 +2408,24 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); entity.addSpecifiedAssociationOverride(0).setName("FOO"); entity.addSpecifiedAssociationOverride(1).setName("BAR"); entity.addSpecifiedAssociationOverride(2).setName("BAZ"); - ListIterator<AssociationOverride> javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + ListIterator<AssociationOverrideAnnotation> javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaAssociationOverrides)); entity.moveSpecifiedAssociationOverride(2, 0); - ListIterator<IAssociationOverride> associationOverrides = entity.specifiedAssociationOverrides(); + ListIterator<AssociationOverride> associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("BAR", associationOverrides.next().getName()); assertEquals("BAZ", associationOverrides.next().getName()); assertEquals("FOO", associationOverrides.next().getName()); - javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); assertEquals("BAR", javaAssociationOverrides.next().getName()); assertEquals("BAZ", javaAssociationOverrides.next().getName()); assertEquals("FOO", javaAssociationOverrides.next().getName()); @@ -2437,7 +2437,7 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("BAR", associationOverrides.next().getName()); assertEquals("FOO", associationOverrides.next().getName()); - javaAssociationOverrides = typeResource.annotations(AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); assertEquals("BAZ", javaAssociationOverrides.next().getName()); assertEquals("BAR", javaAssociationOverrides.next().getName()); assertEquals("FOO", javaAssociationOverrides.next().getName()); @@ -2447,14 +2447,14 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + Entity entity = javaEntity(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - ((AssociationOverride) typeResource.addAnnotation(0, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME)).setName("FOO"); - ((AssociationOverride) typeResource.addAnnotation(1, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME)).setName("BAR"); - ((AssociationOverride) typeResource.addAnnotation(2, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME)).setName("BAZ"); + ((AssociationOverrideAnnotation) typeResource.addAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME)).setName("FOO"); + ((AssociationOverrideAnnotation) typeResource.addAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME)).setName("BAR"); + ((AssociationOverrideAnnotation) typeResource.addAnnotation(2, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME)).setName("BAZ"); - ListIterator<IAssociationOverride> associationOverrides = entity.specifiedAssociationOverrides(); + ListIterator<AssociationOverride> associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("FOO", associationOverrides.next().getName()); assertEquals("BAR", associationOverrides.next().getName()); assertEquals("BAZ", associationOverrides.next().getName()); @@ -2474,18 +2474,18 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals("FOO", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.removeAnnotation(1, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + typeResource.removeAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("BAZ", associationOverrides.next().getName()); assertEquals("FOO", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.removeAnnotation(1, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + typeResource.removeAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertEquals("BAZ", associationOverrides.next().getName()); assertFalse(associationOverrides.hasNext()); - typeResource.removeAnnotation(0, AssociationOverride.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); + typeResource.removeAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverrides.ANNOTATION_NAME); associationOverrides = entity.specifiedAssociationOverrides(); assertFalse(associationOverrides.hasNext()); } @@ -2496,8 +2496,8 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<IAssociationOverride> defaultAssociationOverrides = javaEntity().defaultAssociationOverrides(); - IAssociationOverride defaultAssociationOverride = defaultAssociationOverrides.next(); + ListIterator<AssociationOverride> defaultAssociationOverrides = javaEntity().defaultAssociationOverrides(); + AssociationOverride defaultAssociationOverride = defaultAssociationOverrides.next(); assertEquals("address", defaultAssociationOverride.getName()); assertTrue(defaultAssociationOverride.isVirtual()); @@ -2507,7 +2507,7 @@ public class JavaEntityTests extends ContextModelTestCase assertFalse(defaultAssociationOverrides.hasNext()); javaEntity().addSpecifiedAssociationOverride(0).setName("address"); - IAssociationOverride specifiedAssociationOverride = javaEntity().specifiedAssociationOverrides().next(); + AssociationOverride specifiedAssociationOverride = javaEntity().specifiedAssociationOverrides().next(); assertFalse(specifiedAssociationOverride.isVirtual()); defaultAssociationOverrides = javaEntity().defaultAssociationOverrides(); @@ -2524,18 +2524,18 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IJavaEntity javaEntity = (IJavaEntity) classRefs.next().getJavaPersistentType().getMapping(); + JavaEntity javaEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_SUB_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_SUB_TYPE_NAME); assertEquals(SUB_TYPE_NAME, typeResource.getName()); - assertNull(typeResource.annotation(AssociationOverride.ANNOTATION_NAME)); + assertNull(typeResource.annotation(AssociationOverrideAnnotation.ANNOTATION_NAME)); assertNull(typeResource.annotation(AssociationOverrides.ANNOTATION_NAME)); assertEquals(2, javaEntity.defaultAssociationOverridesSize()); - ListIterator<IJavaAssociationOverride> defaultAssociationOverrides = javaEntity.defaultAssociationOverrides(); - IAssociationOverride defaultAssociationOverride = defaultAssociationOverrides.next(); + ListIterator<JavaAssociationOverride> defaultAssociationOverrides = javaEntity.defaultAssociationOverrides(); + AssociationOverride defaultAssociationOverride = defaultAssociationOverrides.next(); assertEquals("address", defaultAssociationOverride.getName()); defaultAssociationOverride = defaultAssociationOverrides.next(); @@ -2593,12 +2593,12 @@ public class JavaEntityTests extends ContextModelTestCase assertEquals(0, javaEntity().specifiedAssociationOverridesSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); //add an annotation to the resource model and verify the context model is updated - AssociationOverride associationOverride = (AssociationOverride) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("FOO"); - associationOverride = (AssociationOverride) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); assertEquals(2, javaEntity().specifiedAssociationOverridesSize()); @@ -2611,9 +2611,9 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME); - ListIterator<IClassRef> classRefs = persistenceUnit().classRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().classRefs(); classRefs.next(); - IJavaEntity javaEntity = (IJavaEntity) classRefs.next().getJavaPersistentType().getMapping(); + JavaEntity javaEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping(); assertEquals(2, javaEntity.defaultAssociationOverridesSize()); @@ -2631,9 +2631,9 @@ public class JavaEntityTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME); - ListIterator<IClassRef> classRefs = persistenceUnit().classRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().classRefs(); classRefs.next(); - IJavaEntity javaEntity = (IJavaEntity) classRefs.next().getJavaPersistentType().getMapping(); + JavaEntity javaEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping(); assertEquals(2, javaEntity.associationOverridesSize()); @@ -2651,7 +2651,7 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); assertNull(javaEntity().getIdClass()); assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME)); @@ -2682,7 +2682,7 @@ public class JavaEntityTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); assertNull(javaEntity().getIdClass()); assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME)); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java index 58e4a63f29..f27c419644 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaGeneratedValueTests.java @@ -12,13 +12,13 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.context.base.GenerationType; -import org.eclipse.jpt.core.internal.context.base.IGeneratedValue; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.resource.java.GeneratedValue; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.context.GenerationType; +import org.eclipse.jpt.core.context.GeneratedValue; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -66,13 +66,13 @@ public class JavaGeneratedValueTests extends ContextModelTestCase createTestEntityWithGeneratedValue(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertEquals(GENERATOR, idMapping.getGeneratedValue().getGenerator()); //change resource model sequenceGenerator name, verify the context model is updated - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.annotation(JPA.GENERATED_VALUE); generatedValue.setGenerator("foo"); @@ -83,16 +83,16 @@ public class JavaGeneratedValueTests extends ContextModelTestCase createTestEntityWithGeneratedValue(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertEquals(GENERATOR, idMapping.getGeneratedValue().getGenerator()); idMapping.getGeneratedValue().setSpecifiedGenerator("foo"); assertEquals("foo", idMapping.getGeneratedValue().getGenerator()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.annotation(JPA.GENERATED_VALUE); assertEquals("foo", generatedValue.getGenerator()); } @@ -101,16 +101,16 @@ public class JavaGeneratedValueTests extends ContextModelTestCase createTestEntityWithGeneratedValue(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertEquals(GENERATOR, idMapping.getGeneratedValue().getGenerator()); idMapping.getGeneratedValue().setSpecifiedGenerator(null); assertNotNull(idMapping.getGeneratedValue()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.annotation(JPA.GENERATED_VALUE); assertNotNull(generatedValue); } @@ -119,41 +119,41 @@ public class JavaGeneratedValueTests extends ContextModelTestCase createTestEntityWithGeneratedValue(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); - assertEquals(IGeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy()); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); + assertEquals(GeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy()); //change resource model sequenceGenerator name, verify the context model is updated - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.annotation(JPA.GENERATED_VALUE); - generatedValue.setStrategy(org.eclipse.jpt.core.internal.resource.java.GenerationType.IDENTITY); + generatedValue.setStrategy(org.eclipse.jpt.core.resource.java.GenerationType.IDENTITY); assertEquals(GenerationType.IDENTITY, idMapping.getGeneratedValue().getStrategy()); - assertEquals(IGeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getDefaultStrategy()); + assertEquals(GeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getDefaultStrategy()); } public void testSetSpecifiedStrategy() throws Exception { createTestEntityWithGeneratedValue(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); - assertEquals(IGeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy()); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); + assertEquals(GeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy()); idMapping.getGeneratedValue().setSpecifiedStrategy(GenerationType.IDENTITY); assertEquals(GenerationType.IDENTITY, idMapping.getGeneratedValue().getStrategy()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.annotation(JPA.GENERATED_VALUE); - assertEquals(org.eclipse.jpt.core.internal.resource.java.GenerationType.IDENTITY, generatedValue.getStrategy()); + assertEquals(org.eclipse.jpt.core.resource.java.GenerationType.IDENTITY, generatedValue.getStrategy()); idMapping.getGeneratedValue().setSpecifiedStrategy(null); - assertEquals(IGeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy()); - generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE); + assertEquals(GeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy()); + generatedValue = (GeneratedValueAnnotation) attributeResource.annotation(JPA.GENERATED_VALUE); assertNotNull(generatedValue); assertNull(generatedValue.getStrategy()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java index 93b694ebca..3876546201 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaIdMappingTests.java @@ -12,37 +12,37 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.base.TemporalType; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.Column; -import org.eclipse.jpt.core.internal.resource.java.Embedded; -import org.eclipse.jpt.core.internal.resource.java.EmbeddedId; -import org.eclipse.jpt.core.internal.resource.java.GeneratedValue; -import org.eclipse.jpt.core.internal.resource.java.Id; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.ManyToMany; -import org.eclipse.jpt.core.internal.resource.java.ManyToOne; -import org.eclipse.jpt.core.internal.resource.java.OneToMany; -import org.eclipse.jpt.core.internal.resource.java.OneToOne; -import org.eclipse.jpt.core.internal.resource.java.SequenceGenerator; -import org.eclipse.jpt.core.internal.resource.java.TableGenerator; -import org.eclipse.jpt.core.internal.resource.java.Temporal; -import org.eclipse.jpt.core.internal.resource.java.Transient; -import org.eclipse.jpt.core.internal.resource.java.Version; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.TemporalType; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.EmbeddedId; +import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.ManyToMany; +import org.eclipse.jpt.core.resource.java.ManyToOne; +import org.eclipse.jpt.core.resource.java.OneToMany; +import org.eclipse.jpt.core.resource.java.OneToOne; +import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation; +import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation; +import org.eclipse.jpt.core.resource.java.Temporal; +import org.eclipse.jpt.core.resource.java.Transient; +import org.eclipse.jpt.core.resource.java.Version; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -138,8 +138,8 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); @@ -148,27 +148,27 @@ public class JavaIdMappingTests extends ContextModelTestCase idMapping.addSequenceGenerator(); assertFalse(idMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertEquals("FOO", ((IBasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); - assertEquals(TemporalType.TIME, ((IBasicMapping) persistentAttribute.getMapping()).getTemporal()); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((BasicMapping) persistentAttribute.getMapping()).getTemporal()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); @@ -177,26 +177,26 @@ public class JavaIdMappingTests extends ContextModelTestCase idMapping.addSequenceGenerator(); assertFalse(idMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); - assertEquals("FOO", ((IBasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); - assertEquals(TemporalType.TIME, ((IBasicMapping) persistentAttribute.getMapping()).getTemporal()); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((BasicMapping) persistentAttribute.getMapping()).getTemporal()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToVersionMapping() throws Exception { createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); @@ -205,27 +205,27 @@ public class JavaIdMappingTests extends ContextModelTestCase idMapping.addSequenceGenerator(); assertFalse(idMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertEquals("FOO", ((IVersionMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); - assertEquals(TemporalType.TIME, ((IVersionMapping) persistentAttribute.getMapping()).getTemporal()); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertEquals("FOO", ((VersionMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((VersionMapping) persistentAttribute.getMapping()).getTemporal()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedMapping() throws Exception { createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); @@ -234,26 +234,26 @@ public class JavaIdMappingTests extends ContextModelTestCase idMapping.addSequenceGenerator(); assertFalse(idMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); @@ -262,26 +262,26 @@ public class JavaIdMappingTests extends ContextModelTestCase idMapping.addSequenceGenerator(); assertFalse(idMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof TransientMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedIdMapping() throws Exception { createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); @@ -290,26 +290,26 @@ public class JavaIdMappingTests extends ContextModelTestCase idMapping.addSequenceGenerator(); assertFalse(idMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToOneMapping() throws Exception { createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); @@ -318,26 +318,26 @@ public class JavaIdMappingTests extends ContextModelTestCase idMapping.addSequenceGenerator(); assertFalse(idMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); @@ -346,26 +346,26 @@ public class JavaIdMappingTests extends ContextModelTestCase idMapping.addSequenceGenerator(); assertFalse(idMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToOneMapping() throws Exception { createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); @@ -374,26 +374,26 @@ public class JavaIdMappingTests extends ContextModelTestCase idMapping.addSequenceGenerator(); assertFalse(idMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); @@ -402,26 +402,26 @@ public class JavaIdMappingTests extends ContextModelTestCase idMapping.addSequenceGenerator(); assertFalse(idMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(TableGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(SequenceGenerator.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(GeneratedValue.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(TableGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(SequenceGeneratorAnnotation.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(GeneratedValueAnnotation.ANNOTATION_NAME)); } public void testGetTemporal() throws Exception { createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); assertNull(idMapping.getTemporal()); } @@ -430,8 +430,8 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithTemporal(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); assertEquals(TemporalType.TIMESTAMP, idMapping.getTemporal()); } @@ -440,17 +440,17 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); assertNull(idMapping.getTemporal()); idMapping.setTemporal(TemporalType.TIME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Temporal temporal = (Temporal) attributeResource.annotation(Temporal.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.core.internal.resource.java.TemporalType.TIME, temporal.getValue()); + assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue()); idMapping.setTemporal(null); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); @@ -460,16 +460,16 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); assertNull(idMapping.getTemporal()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Temporal temporal = (Temporal) attributeResource.addAnnotation(Temporal.ANNOTATION_NAME); - temporal.setValue(org.eclipse.jpt.core.internal.resource.java.TemporalType.DATE); + temporal.setValue(org.eclipse.jpt.core.resource.java.TemporalType.DATE); assertEquals(TemporalType.DATE, idMapping.getTemporal()); @@ -484,15 +484,15 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); assertNull(idMapping.getColumn().getSpecifiedName()); assertEquals("id", idMapping.getColumn().getName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setName("foo"); assertEquals("foo", idMapping.getColumn().getSpecifiedName()); @@ -504,13 +504,13 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); assertNull(idMapping.getSequenceGenerator()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); attributeResource.addAnnotation(JPA.SEQUENCE_GENERATOR); assertNotNull(idMapping.getSequenceGenerator()); @@ -521,15 +521,15 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); assertNull(idMapping.getSequenceGenerator()); idMapping.addSequenceGenerator(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNotNull(attributeResource.annotation(JPA.SEQUENCE_GENERATOR)); assertNotNull(idMapping.getSequenceGenerator()); @@ -547,11 +547,11 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); attributeResource.addAnnotation(JPA.SEQUENCE_GENERATOR); @@ -573,13 +573,13 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); assertNull(idMapping.getTableGenerator()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); attributeResource.addAnnotation(JPA.TABLE_GENERATOR); assertNotNull(idMapping.getTableGenerator()); @@ -590,15 +590,15 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); assertNull(idMapping.getTableGenerator()); idMapping.addTableGenerator(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNotNull(attributeResource.annotation(JPA.TABLE_GENERATOR)); assertNotNull(idMapping.getTableGenerator()); @@ -616,11 +616,11 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); attributeResource.addAnnotation(JPA.TABLE_GENERATOR); @@ -642,13 +642,13 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); assertNull(idMapping.getGeneratedValue()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); attributeResource.addAnnotation(JPA.GENERATED_VALUE); assertNotNull(idMapping.getGeneratedValue()); @@ -659,11 +659,11 @@ public class JavaIdMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); createTestEntityWithIdMappingGeneratedValue(); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNotNull(idMapping.getGeneratedValue()); assertEquals(1, attributeResource.annotationsSize()); @@ -673,15 +673,15 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); assertNull(idMapping.getGeneratedValue()); idMapping.addGeneratedValue(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNotNull(attributeResource.annotation(JPA.GENERATED_VALUE)); assertNotNull(idMapping.getGeneratedValue()); @@ -699,11 +699,11 @@ public class JavaIdMappingTests extends ContextModelTestCase createTestEntityWithIdMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IIdMapping idMapping = (IIdMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + IdMapping idMapping = (IdMapping) persistentAttribute.getSpecifiedMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); attributeResource.addAnnotation(JPA.GENERATED_VALUE); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinColumnTests.java index dc3b327db2..c3ee65a337 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinColumnTests.java @@ -12,12 +12,12 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.context.java.IJavaJoinColumn; -import org.eclipse.jpt.core.internal.context.java.IJavaOneToOneMapping; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JoinColumn; +import org.eclipse.jpt.core.context.java.JavaJoinColumn; +import org.eclipse.jpt.core.context.java.JavaOneToOneMapping; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -121,50 +121,50 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, oneToOneMapping.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set name in the resource model, verify context model updated - javaJoinColumn = (JoinColumn) attributeResource.addAnnotation(JoinColumn.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); - IJavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); + JavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); assertEquals("FOO", joinColumn.getSpecifiedName()); assertEquals("FOO", javaJoinColumn.getName()); //set name to null in the resource model, annotation removed, specified join column removed javaJoinColumn.setName(null); assertEquals(0, oneToOneMapping.specifiedJoinColumnsSize()); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testModifySpecifiedName() throws Exception { createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - IJavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); //set name in the context model, verify resource model modified joinColumn.setSpecifiedName("foo"); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals("foo", joinColumn.getSpecifiedName()); assertEquals("foo", javaJoinColumn.getName()); //set name to null in the context model joinColumn.setSpecifiedName(null); assertNull(joinColumn.getSpecifiedName()); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } // <attribute name>_<referenced column name> @@ -176,8 +176,8 @@ public class JavaJoinColumnTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - IJavaJoinColumn defaultJavaJoinColumn = oneToOneMapping.getDefaultJoinColumn(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaJoinColumn defaultJavaJoinColumn = oneToOneMapping.getDefaultJoinColumn(); assertNull(defaultJavaJoinColumn.getDefaultName()); //TODO test default join column name @@ -215,22 +215,22 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, oneToOneMapping.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set referenced column name in the resource model, verify context model updated - javaJoinColumn = (JoinColumn) attributeResource.addAnnotation(JoinColumn.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); javaJoinColumn.setReferencedColumnName("BAR"); - IJavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); + JavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); assertEquals("BAR", joinColumn.getSpecifiedReferencedColumnName()); assertEquals("BAR", javaJoinColumn.getReferencedColumnName()); @@ -244,17 +244,17 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - IJavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); //set referenced column name in the context model, verify resource model modified joinColumn.setSpecifiedName("foo"); joinColumn.setSpecifiedReferencedColumnName("BAR"); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals("BAR", joinColumn.getSpecifiedReferencedColumnName()); assertEquals("BAR", javaJoinColumn.getReferencedColumnName()); @@ -273,22 +273,22 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, oneToOneMapping.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set table in the resource model, verify context model updated - javaJoinColumn = (JoinColumn) attributeResource.addAnnotation(JoinColumn.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); javaJoinColumn.setTable("BAR"); - IJavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); + JavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); assertEquals("BAR", joinColumn.getSpecifiedTable()); assertEquals("BAR", javaJoinColumn.getTable()); @@ -302,17 +302,17 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - IJavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); //set table in the context model, verify resource model modified joinColumn.setSpecifiedName("foo"); joinColumn.setSpecifiedTable("BAR"); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals("BAR", joinColumn.getSpecifiedTable()); assertEquals("BAR", javaJoinColumn.getTable()); @@ -331,22 +331,22 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, oneToOneMapping.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set unique in the resource model, verify context model updated - javaJoinColumn = (JoinColumn) attributeResource.addAnnotation(JoinColumn.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); javaJoinColumn.setUnique(Boolean.TRUE); - IJavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); + JavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); assertEquals(Boolean.TRUE, joinColumn.getSpecifiedUnique()); assertEquals(Boolean.TRUE, javaJoinColumn.getUnique()); @@ -360,17 +360,17 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - IJavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); //set unique in the context model, verify resource model modified joinColumn.setSpecifiedName("foo"); joinColumn.setSpecifiedUnique(Boolean.TRUE); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(Boolean.TRUE, joinColumn.getSpecifiedUnique()); assertEquals(Boolean.TRUE, javaJoinColumn.getUnique()); @@ -384,22 +384,22 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, oneToOneMapping.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set nullable in the resource model, verify context model updated - javaJoinColumn = (JoinColumn) attributeResource.addAnnotation(JoinColumn.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); javaJoinColumn.setNullable(Boolean.FALSE); - IJavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); + JavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); assertEquals(Boolean.FALSE, joinColumn.getSpecifiedNullable()); assertEquals(Boolean.FALSE, javaJoinColumn.getNullable()); @@ -413,17 +413,17 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - IJavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); //set nullable in the context model, verify resource model modified joinColumn.setSpecifiedName("foo"); joinColumn.setSpecifiedNullable(Boolean.FALSE); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(Boolean.FALSE, joinColumn.getSpecifiedNullable()); assertEquals(Boolean.FALSE, javaJoinColumn.getNullable()); @@ -437,22 +437,22 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, oneToOneMapping.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set insertable in the resource model, verify context model updated - javaJoinColumn = (JoinColumn) attributeResource.addAnnotation(JoinColumn.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); javaJoinColumn.setInsertable(Boolean.FALSE); - IJavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); + JavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); assertEquals(Boolean.FALSE, joinColumn.getSpecifiedInsertable()); assertEquals(Boolean.FALSE, javaJoinColumn.getInsertable()); @@ -466,17 +466,17 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - IJavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); //set insertable in the context model, verify resource model modified joinColumn.setSpecifiedName("foo"); joinColumn.setSpecifiedInsertable(Boolean.FALSE); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(Boolean.FALSE, joinColumn.getSpecifiedInsertable()); assertEquals(Boolean.FALSE, javaJoinColumn.getInsertable()); @@ -490,22 +490,22 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(0, oneToOneMapping.specifiedJoinColumnsSize()); assertNull(javaJoinColumn); //set updatable in the resource model, verify context model updated - javaJoinColumn = (JoinColumn) attributeResource.addAnnotation(JoinColumn.ANNOTATION_NAME); + javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME); javaJoinColumn.setName("FOO"); javaJoinColumn.setUpdatable(Boolean.FALSE); - IJavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); + JavaJoinColumn joinColumn = oneToOneMapping.specifiedJoinColumns().next(); assertEquals(Boolean.FALSE, joinColumn.getSpecifiedUpdatable()); assertEquals(Boolean.FALSE, javaJoinColumn.getUpdatable()); @@ -519,17 +519,17 @@ public class JavaJoinColumnTests extends ContextModelTestCase createTestEntityWithOneToOne(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaOneToOneMapping oneToOneMapping = (IJavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) javaPersistentType().attributes().next().getMapping(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - IJavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JavaJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); //set updatable in the context model, verify resource model modified joinColumn.setSpecifiedName("foo"); joinColumn.setSpecifiedUpdatable(Boolean.FALSE); - JoinColumn javaJoinColumn = (JoinColumn) attributeResource.annotation(JoinColumn.ANNOTATION_NAME); + JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME); assertEquals(Boolean.FALSE, joinColumn.getSpecifiedUpdatable()); assertEquals(Boolean.FALSE, javaJoinColumn.getUpdatable()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java index ab97ebec0e..ce06542fd8 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaJoinTableTests.java @@ -13,13 +13,13 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.context.base.IJoinColumn; -import org.eclipse.jpt.core.internal.context.base.IJoinTable; -import org.eclipse.jpt.core.internal.context.java.IJavaManyToManyMapping; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JoinTable; +import org.eclipse.jpt.core.context.JoinColumn; +import org.eclipse.jpt.core.context.JoinTable; +import org.eclipse.jpt.core.context.java.JavaManyToManyMapping; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JoinTableAnnotation; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -118,21 +118,21 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinTable javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedName()); assertNull(javaJoinTable); //set name in the resource model, verify context model updated - attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME); - javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + javaJoinTable = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); javaJoinTable.setName("FOO"); assertEquals("FOO", joinTable.getSpecifiedName()); assertEquals("FOO", javaJoinTable.getName()); @@ -146,36 +146,36 @@ public class JavaJoinTableTests extends ContextModelTestCase assertEquals("FOO", joinTable.getSpecifiedName()); assertEquals("FOO", javaJoinTable.getName()); - attributeResource.removeAnnotation(JoinTable.ANNOTATION_NAME); + attributeResource.removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedName()); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); } public void testModifySpecifiedName() throws Exception { createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinTable javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedName()); assertNull(javaJoinTable); //set name in the context model, verify resource model modified joinTable.setSpecifiedName("foo"); - javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + javaJoinTable = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals("foo", joinTable.getSpecifiedName()); assertEquals("foo", javaJoinTable.getName()); //set name to null in the context model joinTable.setSpecifiedName(null); assertNull(joinTable.getSpecifiedName()); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); } public void testDefaultName() throws Exception { @@ -184,8 +184,8 @@ public class JavaJoinTableTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); //joinTable default name is null because targetEntity is not in the persistence unit assertNull(joinTable.getDefaultName()); @@ -194,9 +194,9 @@ public class JavaJoinTableTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".Project"); assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); //target entity does not resolve, default name is null manyToManyMapping.setSpecifiedTargetEntity("Foo"); @@ -207,9 +207,9 @@ public class JavaJoinTableTests extends ContextModelTestCase assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName()); //add the join table annotation, verify default join table name is the same - attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME); + attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName()); - assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); //set a table on the target entity, very default join table name updates manyToManyMapping.getResolvedTargetEntity().getTable().setSpecifiedName("FOO"); @@ -224,21 +224,21 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinTable javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedSchema()); assertNull(javaJoinTable); //set schema in the resource model, verify context model updated - attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME); - javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + javaJoinTable = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); javaJoinTable.setSchema("FOO"); assertEquals("FOO", joinTable.getSpecifiedSchema()); assertEquals("FOO", javaJoinTable.getSchema()); @@ -252,36 +252,36 @@ public class JavaJoinTableTests extends ContextModelTestCase assertEquals("FOO", joinTable.getSpecifiedSchema()); assertEquals("FOO", javaJoinTable.getSchema()); - attributeResource.removeAnnotation(JoinTable.ANNOTATION_NAME); + attributeResource.removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedSchema()); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); } public void testModifySpecifiedSchema() throws Exception { createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinTable javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedSchema()); assertNull(javaJoinTable); //set schema in the context model, verify resource model modified joinTable.setSpecifiedSchema("foo"); - javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + javaJoinTable = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals("foo", joinTable.getSpecifiedSchema()); assertEquals("foo", javaJoinTable.getSchema()); //set schema to null in the context model joinTable.setSpecifiedSchema(null); assertNull(joinTable.getSpecifiedSchema()); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); } //// public void testUpdateDefaultSchemaFromJavaTable() throws Exception { @@ -375,21 +375,21 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinTable javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedCatalog()); assertNull(javaJoinTable); //set catalog in the resource model, verify context model updated - attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME); - javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); + javaJoinTable = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); javaJoinTable.setCatalog("FOO"); assertEquals("FOO", joinTable.getSpecifiedCatalog()); assertEquals("FOO", javaJoinTable.getCatalog()); @@ -403,70 +403,70 @@ public class JavaJoinTableTests extends ContextModelTestCase assertEquals("FOO", joinTable.getSpecifiedCatalog()); assertEquals("FOO", javaJoinTable.getCatalog()); - attributeResource.removeAnnotation(JoinTable.ANNOTATION_NAME); + attributeResource.removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedCatalog()); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); } public void testModifySpecifiedCatalog() throws Exception { createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinTable javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertNull(joinTable.getSpecifiedCatalog()); assertNull(javaJoinTable); //set catalog in the context model, verify resource model modified joinTable.setSpecifiedCatalog("foo"); - javaJoinTable = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + javaJoinTable = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals("foo", joinTable.getSpecifiedCatalog()); assertEquals("foo", javaJoinTable.getCatalog()); //set catalog to null in the context model joinTable.setSpecifiedCatalog(null); assertNull(joinTable.getSpecifiedCatalog()); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); } public void testAddSpecifiedJoinColumn() throws Exception { createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - IJoinColumn joinColumn = joinTable.addSpecifiedJoinColumn(0); + JoinColumn joinColumn = joinTable.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("FOO"); - JoinTable joinTableResource = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals("FOO", joinTableResource.joinColumnAt(0).getName()); - IJoinColumn joinColumn2 = joinTable.addSpecifiedJoinColumn(0); + JoinColumn joinColumn2 = joinTable.addSpecifiedJoinColumn(0); joinColumn2.setSpecifiedName("BAR"); assertEquals("BAR", joinTableResource.joinColumnAt(0).getName()); assertEquals("FOO", joinTableResource.joinColumnAt(1).getName()); - IJoinColumn joinColumn3 = joinTable.addSpecifiedJoinColumn(1); + JoinColumn joinColumn3 = joinTable.addSpecifiedJoinColumn(1); joinColumn3.setSpecifiedName("BAZ"); assertEquals("BAR", joinTableResource.joinColumnAt(0).getName()); assertEquals("BAZ", joinTableResource.joinColumnAt(1).getName()); assertEquals("FOO", joinTableResource.joinColumnAt(2).getName()); - ListIterator<IJoinColumn> joinColumns = joinTable.specifiedJoinColumns(); + ListIterator<JoinColumn> joinColumns = joinTable.specifiedJoinColumns(); assertEquals(joinColumn2, joinColumns.next()); assertEquals(joinColumn3, joinColumns.next()); assertEquals(joinColumn, joinColumns.next()); @@ -481,17 +481,17 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); joinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); joinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); joinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ"); - JoinTable joinTableResource = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals(3, joinTableResource.joinColumnsSize()); joinTable.removeSpecifiedJoinColumn(0); @@ -511,22 +511,22 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); joinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); joinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); joinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ"); - JoinTable joinTableResource = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals(3, joinTableResource.joinColumnsSize()); joinTable.moveSpecifiedJoinColumn(2, 0); - ListIterator<IJoinColumn> joinColumns = joinTable.specifiedJoinColumns(); + ListIterator<JoinColumn> joinColumns = joinTable.specifiedJoinColumns(); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); @@ -551,13 +551,13 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinTable joinTableResource = (JoinTable) attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); joinTableResource.addJoinColumn(0); joinTableResource.addJoinColumn(1); @@ -567,7 +567,7 @@ public class JavaJoinTableTests extends ContextModelTestCase joinTableResource.joinColumnAt(1).setName("BAR"); joinTableResource.joinColumnAt(2).setName("BAZ"); - ListIterator<IJoinColumn> joinColumns = joinTable.specifiedJoinColumns(); + ListIterator<JoinColumn> joinColumns = joinTable.specifiedJoinColumns(); assertEquals("FOO", joinColumns.next().getName()); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); @@ -610,8 +610,8 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); assertEquals(0, joinTable.specifiedJoinColumnsSize()); @@ -626,8 +626,8 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); assertEquals(1, joinTable.joinColumnsSize()); @@ -650,34 +650,34 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - IJoinColumn inverseJoinColumn = joinTable.addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = joinTable.addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("FOO"); - JoinTable joinTableResource = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals("FOO", joinTableResource.inverseJoinColumnAt(0).getName()); - IJoinColumn inverseJoinColumn2 = joinTable.addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn2 = joinTable.addSpecifiedInverseJoinColumn(0); inverseJoinColumn2.setSpecifiedName("BAR"); assertEquals("BAR", joinTableResource.inverseJoinColumnAt(0).getName()); assertEquals("FOO", joinTableResource.inverseJoinColumnAt(1).getName()); - IJoinColumn inverseJoinColumn3 = joinTable.addSpecifiedInverseJoinColumn(1); + JoinColumn inverseJoinColumn3 = joinTable.addSpecifiedInverseJoinColumn(1); inverseJoinColumn3.setSpecifiedName("BAZ"); assertEquals("BAR", joinTableResource.inverseJoinColumnAt(0).getName()); assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(1).getName()); assertEquals("FOO", joinTableResource.inverseJoinColumnAt(2).getName()); - ListIterator<IJoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns(); + ListIterator<JoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns(); assertEquals(inverseJoinColumn2, inverseJoinColumns.next()); assertEquals(inverseJoinColumn3, inverseJoinColumns.next()); assertEquals(inverseJoinColumn, inverseJoinColumns.next()); @@ -692,17 +692,17 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); joinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO"); joinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR"); joinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ"); - JoinTable joinTableResource = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals(3, joinTableResource.inverseJoinColumnsSize()); joinTable.removeSpecifiedInverseJoinColumn(0); @@ -722,22 +722,22 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); joinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO"); joinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR"); joinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ"); - JoinTable joinTableResource = (JoinTable) attributeResource.annotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME); assertEquals(3, joinTableResource.inverseJoinColumnsSize()); joinTable.moveSpecifiedInverseJoinColumn(2, 0); - ListIterator<IJoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns(); + ListIterator<JoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns(); assertEquals("BAR", inverseJoinColumns.next().getName()); assertEquals("BAZ", inverseJoinColumns.next().getName()); assertEquals("FOO", inverseJoinColumns.next().getName()); @@ -762,13 +762,13 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - JoinTable joinTableResource = (JoinTable) attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME); + JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); joinTableResource.addInverseJoinColumn(0); joinTableResource.addInverseJoinColumn(1); @@ -778,7 +778,7 @@ public class JavaJoinTableTests extends ContextModelTestCase joinTableResource.inverseJoinColumnAt(1).setName("BAR"); joinTableResource.inverseJoinColumnAt(2).setName("BAZ"); - ListIterator<IJoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns(); + ListIterator<JoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns(); assertEquals("FOO", inverseJoinColumns.next().getName()); assertEquals("BAR", inverseJoinColumns.next().getName()); assertEquals("BAZ", inverseJoinColumns.next().getName()); @@ -821,8 +821,8 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); assertEquals(0, joinTable.specifiedInverseJoinColumnsSize()); @@ -837,8 +837,8 @@ public class JavaJoinTableTests extends ContextModelTestCase createTestEntityWithManyToMany(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IJavaManyToManyMapping manyToManyMapping = (IJavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); - IJoinTable joinTable = manyToManyMapping.getJoinTable(); + JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) javaPersistentType().attributes().next().getMapping(); + JoinTable joinTable = manyToManyMapping.getJoinTable(); assertEquals(1, joinTable.inverseJoinColumnsSize()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java index 1c6c6f30d6..0e6eeea85b 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToManyMappingTests.java @@ -13,38 +13,38 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.FetchType; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.ITypeMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType; -import org.eclipse.jpt.core.internal.context.persistence.IClassRef; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.Embedded; -import org.eclipse.jpt.core.internal.resource.java.EmbeddedId; -import org.eclipse.jpt.core.internal.resource.java.Id; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JoinTable; -import org.eclipse.jpt.core.internal.resource.java.ManyToMany; -import org.eclipse.jpt.core.internal.resource.java.ManyToOne; -import org.eclipse.jpt.core.internal.resource.java.MapKey; -import org.eclipse.jpt.core.internal.resource.java.OneToMany; -import org.eclipse.jpt.core.internal.resource.java.OneToOne; -import org.eclipse.jpt.core.internal.resource.java.OrderBy; -import org.eclipse.jpt.core.internal.resource.java.Transient; -import org.eclipse.jpt.core.internal.resource.java.Version; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.FetchType; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.TypeMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.java.JavaPersistentType; +import org.eclipse.jpt.core.context.persistence.ClassRef; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.EmbeddedId; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JoinTableAnnotation; +import org.eclipse.jpt.core.resource.java.ManyToMany; +import org.eclipse.jpt.core.resource.java.ManyToOne; +import org.eclipse.jpt.core.resource.java.MapKey; +import org.eclipse.jpt.core.resource.java.OneToMany; +import org.eclipse.jpt.core.resource.java.OneToOne; +import org.eclipse.jpt.core.resource.java.OrderBy; +import org.eclipse.jpt.core.resource.java.Transient; +import org.eclipse.jpt.core.resource.java.Version; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -194,21 +194,21 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); manyToManyMapping.setOrderBy("asdf"); manyToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(manyToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof BasicMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -216,20 +216,20 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); manyToManyMapping.setOrderBy("asdf"); manyToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(manyToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); assertNull(persistentAttribute.getSpecifiedMapping()); assertTrue(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -237,21 +237,21 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); manyToManyMapping.setOrderBy("asdf"); manyToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(manyToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof VersionMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -259,21 +259,21 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); manyToManyMapping.setOrderBy("asdf"); manyToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(manyToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof IdMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -281,21 +281,21 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); manyToManyMapping.setOrderBy("asdf"); manyToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(manyToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -303,21 +303,21 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); manyToManyMapping.setOrderBy("asdf"); manyToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(manyToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -325,21 +325,21 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); manyToManyMapping.setOrderBy("asdf"); manyToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(manyToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof TransientMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -347,21 +347,21 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); manyToManyMapping.setOrderBy("asdf"); manyToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(manyToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -369,21 +369,21 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); manyToManyMapping.setOrderBy("asdf"); manyToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(manyToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -391,21 +391,21 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); manyToManyMapping.setOrderBy("asdf"); manyToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(manyToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -413,11 +413,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(); assertNull(manyToManyMapping.getSpecifiedTargetEntity()); @@ -438,11 +438,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(); assertNull(manyToManyMapping.getSpecifiedTargetEntity()); @@ -463,24 +463,24 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(); assertNull(manyToManyMapping.getSpecifiedFetch()); assertNull(manyToMany.getFetch()); //set fetch in the resource model, verify context model updated - manyToMany.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER); + manyToMany.setFetch(org.eclipse.jpt.core.resource.java.FetchType.EAGER); assertEquals(FetchType.EAGER, manyToManyMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER, manyToMany.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, manyToMany.getFetch()); - manyToMany.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY); + manyToMany.setFetch(org.eclipse.jpt.core.resource.java.FetchType.LAZY); assertEquals(FetchType.LAZY, manyToManyMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, manyToMany.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, manyToMany.getFetch()); //set fetch to null in the resource model @@ -493,11 +493,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(); assertNull(manyToManyMapping.getSpecifiedFetch()); @@ -506,11 +506,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase //set fetch in the context model, verify resource model updated manyToManyMapping.setSpecifiedFetch(FetchType.EAGER); assertEquals(FetchType.EAGER, manyToManyMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER, manyToMany.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, manyToMany.getFetch()); manyToManyMapping.setSpecifiedFetch(FetchType.LAZY); assertEquals(FetchType.LAZY, manyToManyMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, manyToMany.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, manyToMany.getFetch()); //set fetch to null in the context model @@ -523,11 +523,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(); assertNull(manyToManyMapping.getMappedBy()); @@ -548,11 +548,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(); assertNull(manyToManyMapping.getMappedBy()); @@ -576,8 +576,8 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".Address"); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); Iterator<String> attributeNames = manyToManyMapping.candidateMappedByAttributeNames(); assertEquals("id", attributeNames.next()); @@ -604,8 +604,8 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestTargetEntityAddress(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); //targetEntity not in the persistence unit, default still set, handled by validation assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getDefaultTargetEntity()); @@ -618,13 +618,13 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase manyToManyMapping.setSpecifiedTargetEntity("foo"); assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getDefaultTargetEntity()); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef addressClassRef = classRefs.next(); - IJavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType(); + ClassRef addressClassRef = classRefs.next(); + JavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType(); //test target is not an Entity, default target entity still exists, this case handled with validation - addressPersistentType.setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY); + addressPersistentType.setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY); assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getDefaultTargetEntity()); } @@ -634,8 +634,8 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".Address"); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); assertNull(manyToManyMapping.getDefaultTargetEntity()); } @@ -646,8 +646,8 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".Address"); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); assertNull(manyToManyMapping.getDefaultTargetEntity()); } @@ -657,8 +657,8 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestTargetEntityAddress(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getTargetEntity()); @@ -674,18 +674,18 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestTargetEntityAddress(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); //targetEntity not in the persistence unit assertNull(manyToManyMapping.getResolvedTargetEntity()); //add targetEntity to the persistence unit, now target entity should resolve addXmlClassRef(PACKAGE_NAME + ".Address"); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef addressClassRef = classRefs.next(); - ITypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping(); + ClassRef addressClassRef = classRefs.next(); + TypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping(); assertEquals(addressTypeMapping, manyToManyMapping.getResolvedTargetEntity()); //test default still the same when specified target entity it set @@ -706,11 +706,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(manyToManyMapping.getMapKey()); assertNull(attributeResource.annotation(MapKey.ANNOTATION_NAME)); @@ -741,11 +741,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(manyToManyMapping.getMapKey()); assertNull(attributeResource.annotation(MapKey.ANNOTATION_NAME)); @@ -766,11 +766,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(manyToManyMapping.getOrderBy()); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); @@ -792,11 +792,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(manyToManyMapping.getOrderBy()); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); @@ -817,11 +817,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertTrue(manyToManyMapping.isNoOrdering()); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); @@ -844,11 +844,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertTrue(manyToManyMapping.isNoOrdering()); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); @@ -870,11 +870,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertFalse(manyToManyMapping.isPkOrdering()); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); @@ -897,11 +897,11 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase createTestEntityWithManyToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertFalse(manyToManyMapping.isCustomOrdering()); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java index 9fabef646f..d0c108fb69 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaManyToOneMappingTests.java @@ -13,39 +13,39 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IJoinColumn; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.ITypeMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.java.IJavaJoinColumn; -import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType; -import org.eclipse.jpt.core.internal.context.persistence.IClassRef; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.Embedded; -import org.eclipse.jpt.core.internal.resource.java.EmbeddedId; -import org.eclipse.jpt.core.internal.resource.java.Id; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.JoinColumn; -import org.eclipse.jpt.core.internal.resource.java.JoinColumns; -import org.eclipse.jpt.core.internal.resource.java.ManyToMany; -import org.eclipse.jpt.core.internal.resource.java.ManyToOne; -import org.eclipse.jpt.core.internal.resource.java.OneToMany; -import org.eclipse.jpt.core.internal.resource.java.OneToOne; -import org.eclipse.jpt.core.internal.resource.java.Transient; -import org.eclipse.jpt.core.internal.resource.java.Version; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.JoinColumn; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.TypeMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.java.JavaJoinColumn; +import org.eclipse.jpt.core.context.java.JavaPersistentType; +import org.eclipse.jpt.core.context.persistence.ClassRef; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.EmbeddedId; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JoinColumns; +import org.eclipse.jpt.core.resource.java.ManyToMany; +import org.eclipse.jpt.core.resource.java.ManyToOne; +import org.eclipse.jpt.core.resource.java.OneToMany; +import org.eclipse.jpt.core.resource.java.OneToOne; +import org.eclipse.jpt.core.resource.java.Transient; +import org.eclipse.jpt.core.resource.java.Version; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.CollectionTools; @@ -198,210 +198,210 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0); assertFalse(manyToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof BasicMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0); assertFalse(manyToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); assertNull(persistentAttribute.getSpecifiedMapping()); assertTrue(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToVersionMapping() throws Exception { createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0); assertFalse(manyToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof VersionMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToIdMapping() throws Exception { createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0); assertFalse(manyToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof IdMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedMapping() throws Exception { createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0); assertFalse(manyToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedIdMapping() throws Exception { createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0); assertFalse(manyToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0); assertFalse(manyToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof TransientMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToOneMapping() throws Exception { createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0); assertFalse(manyToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0); assertFalse(manyToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0); assertFalse(manyToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testUpdateSpecifiedTargetEntity() throws Exception { createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(); assertNull(manyToOneMapping.getSpecifiedTargetEntity()); @@ -422,11 +422,11 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(); assertNull(manyToOneMapping.getSpecifiedTargetEntity()); @@ -447,11 +447,11 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(); assertNull(manyToOneMapping.getSpecifiedOptional()); @@ -477,11 +477,11 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(); assertNull(manyToOneMapping.getSpecifiedOptional()); @@ -508,24 +508,24 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); - ListIterator<IJavaJoinColumn> specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns(); + ListIterator<JavaJoinColumn> specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns(); assertFalse(specifiedJoinColumns.hasNext()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //add an annotation to the resource model and verify the context model is updated - JoinColumn joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("FOO"); specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns(); assertEquals("FOO", specifiedJoinColumns.next().getName()); assertFalse(specifiedJoinColumns.hasNext()); - joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("BAR"); specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns(); assertEquals("BAR", specifiedJoinColumns.next().getName()); @@ -533,7 +533,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase assertFalse(specifiedJoinColumns.hasNext()); - joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("BAZ"); specifiedJoinColumns = manyToOneMapping.specifiedJoinColumns(); assertEquals("BAZ", specifiedJoinColumns.next().getName()); @@ -574,8 +574,8 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); assertEquals(0, manyToOneMapping.specifiedJoinColumnsSize()); @@ -590,8 +590,8 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); assertEquals(1, manyToOneMapping.joinColumnsSize()); @@ -610,20 +610,20 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); manyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("BAR"); manyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Iterator<JavaResource> joinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + Iterator<JavaResourceNode> joinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); - assertEquals("BAZ", ((JoinColumn) joinColumns.next()).getName()); - assertEquals("BAR", ((JoinColumn) joinColumns.next()).getName()); - assertEquals("FOO", ((JoinColumn) joinColumns.next()).getName()); + assertEquals("BAZ", ((JoinColumnAnnotation) joinColumns.next()).getName()); + assertEquals("BAR", ((JoinColumnAnnotation) joinColumns.next()).getName()); + assertEquals("FOO", ((JoinColumnAnnotation) joinColumns.next()).getName()); assertFalse(joinColumns.hasNext()); } @@ -631,54 +631,54 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); manyToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); manyToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Iterator<JavaResource> joinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + Iterator<JavaResourceNode> joinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); - assertEquals("FOO", ((JoinColumn) joinColumns.next()).getName()); - assertEquals("BAR", ((JoinColumn) joinColumns.next()).getName()); - assertEquals("BAZ", ((JoinColumn) joinColumns.next()).getName()); + assertEquals("FOO", ((JoinColumnAnnotation) joinColumns.next()).getName()); + assertEquals("BAR", ((JoinColumnAnnotation) joinColumns.next()).getName()); + assertEquals("BAZ", ((JoinColumnAnnotation) joinColumns.next()).getName()); assertFalse(joinColumns.hasNext()); } public void testRemoveSpecifiedJoinColumn() throws Exception { createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); manyToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); manyToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - assertEquals(3, CollectionTools.size(attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME))); manyToOneMapping.removeSpecifiedJoinColumn(1); - Iterator<JavaResource> joinColumnResources = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); - assertEquals("FOO", ((JoinColumn) joinColumnResources.next()).getName()); - assertEquals("BAZ", ((JoinColumn) joinColumnResources.next()).getName()); + Iterator<JavaResourceNode> joinColumnResources = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + assertEquals("FOO", ((JoinColumnAnnotation) joinColumnResources.next()).getName()); + assertEquals("BAZ", ((JoinColumnAnnotation) joinColumnResources.next()).getName()); assertFalse(joinColumnResources.hasNext()); - Iterator<IJoinColumn> joinColumns = manyToOneMapping.specifiedJoinColumns(); + Iterator<JoinColumn> joinColumns = manyToOneMapping.specifiedJoinColumns(); assertEquals("FOO", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); manyToOneMapping.removeSpecifiedJoinColumn(1); - joinColumnResources = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); - assertEquals("FOO", ((JoinColumn) joinColumnResources.next()).getName()); + joinColumnResources = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + assertEquals("FOO", ((JoinColumnAnnotation) joinColumnResources.next()).getName()); assertFalse(joinColumnResources.hasNext()); joinColumns = manyToOneMapping.specifiedJoinColumns(); @@ -687,7 +687,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase manyToOneMapping.removeSpecifiedJoinColumn(0); - joinColumnResources = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + joinColumnResources = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); assertFalse(joinColumnResources.hasNext()); joinColumns = manyToOneMapping.specifiedJoinColumns(); assertFalse(joinColumns.hasNext()); @@ -699,26 +699,26 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); manyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); manyToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); manyToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ"); - JavaPersistentAttributeResource attributeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME).attributes().next(); + JavaResourcePersistentAttribute attributeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME).attributes().next(); - ListIterator<JoinColumn> javaJoinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + ListIterator<JoinColumnAnnotation> javaJoinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaJoinColumns)); manyToOneMapping.moveSpecifiedJoinColumn(2, 0); - ListIterator<IJoinColumn> primaryKeyJoinColumns = manyToOneMapping.specifiedJoinColumns(); + ListIterator<JoinColumn> primaryKeyJoinColumns = manyToOneMapping.specifiedJoinColumns(); assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaJoinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + javaJoinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); assertEquals("BAR", javaJoinColumns.next().getName()); assertEquals("BAZ", javaJoinColumns.next().getName()); assertEquals("FOO", javaJoinColumns.next().getName()); @@ -730,7 +730,7 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaJoinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + javaJoinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); assertEquals("BAZ", javaJoinColumns.next().getName()); assertEquals("BAR", javaJoinColumns.next().getName()); assertEquals("FOO", javaJoinColumns.next().getName()); @@ -740,15 +740,15 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); - JavaPersistentAttributeResource attributeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME).attributes().next(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); + JavaResourcePersistentAttribute attributeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME).attributes().next(); - ((JoinColumn) attributeResource.addAnnotation(0, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("FOO"); - ((JoinColumn) attributeResource.addAnnotation(1, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("BAR"); - ((JoinColumn) attributeResource.addAnnotation(2, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("BAZ"); + ((JoinColumnAnnotation) attributeResource.addAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("FOO"); + ((JoinColumnAnnotation) attributeResource.addAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("BAR"); + ((JoinColumnAnnotation) attributeResource.addAnnotation(2, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("BAZ"); - ListIterator<IJoinColumn> joinColumns = manyToOneMapping.specifiedJoinColumns(); + ListIterator<JoinColumn> joinColumns = manyToOneMapping.specifiedJoinColumns(); assertEquals("FOO", joinColumns.next().getName()); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); @@ -768,18 +768,18 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase assertEquals("FOO", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); - attributeResource.removeAnnotation(1, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + attributeResource.removeAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); joinColumns = manyToOneMapping.specifiedJoinColumns(); assertEquals("BAZ", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); - attributeResource.removeAnnotation(1, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + attributeResource.removeAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); joinColumns = manyToOneMapping.specifiedJoinColumns(); assertEquals("BAZ", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); - attributeResource.removeAnnotation(0, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + attributeResource.removeAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); joinColumns = manyToOneMapping.specifiedJoinColumns(); assertFalse(joinColumns.hasNext()); } @@ -787,13 +787,13 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestEntityWithManyToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); assertTrue(manyToOneMapping.getDefaultJoinColumn().isVirtual()); manyToOneMapping.addSpecifiedJoinColumn(0); - IJoinColumn specifiedJoinColumn = manyToOneMapping.specifiedJoinColumns().next(); + JoinColumn specifiedJoinColumn = manyToOneMapping.specifiedJoinColumns().next(); assertFalse(specifiedJoinColumn.isVirtual()); assertNull(manyToOneMapping.getDefaultJoinColumn()); @@ -804,8 +804,8 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestTargetEntityAddress(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); //targetEntity not in the persistence unit, default still set, handled by validation assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getDefaultTargetEntity()); @@ -818,13 +818,13 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase manyToOneMapping.setSpecifiedTargetEntity("foo"); assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getDefaultTargetEntity()); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef addressClassRef = classRefs.next(); - IJavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType(); + ClassRef addressClassRef = classRefs.next(); + JavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType(); //test target is not an Entity, default target entity still exists, this case handled with validation - addressPersistentType.setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY); + addressPersistentType.setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY); assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getDefaultTargetEntity()); } @@ -834,8 +834,8 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".Address"); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); assertNull(manyToOneMapping.getDefaultTargetEntity()); } @@ -846,8 +846,8 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".Address"); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); assertNull(manyToOneMapping.getDefaultTargetEntity()); } @@ -858,8 +858,8 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".Address"); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); assertEquals(PACKAGE_NAME + ".Address", manyToOneMapping.getTargetEntity()); @@ -875,18 +875,18 @@ public class JavaManyToOneMappingTests extends ContextModelTestCase createTestTargetEntityAddress(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IManyToOneMapping manyToOneMapping = (IManyToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + ManyToOneMapping manyToOneMapping = (ManyToOneMapping) persistentAttribute.getMapping(); //targetEntity not in the persistence unit assertNull(manyToOneMapping.getResolvedTargetEntity()); //add targetEntity to the persistence unit, now target entity should resolve addXmlClassRef(PACKAGE_NAME + ".Address"); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef addressClassRef = classRefs.next(); - ITypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping(); + ClassRef addressClassRef = classRefs.next(); + TypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping(); assertEquals(addressTypeMapping, manyToOneMapping.getResolvedTargetEntity()); //test default still the same when specified target entity it set diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java index 111753d8f2..47023845db 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaMappedSuperclassTests.java @@ -12,15 +12,15 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.IEmbeddable; -import org.eclipse.jpt.core.internal.context.base.IEntity; -import org.eclipse.jpt.core.internal.context.base.IMappedSuperclass; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.Embeddable; +import org.eclipse.jpt.core.context.Entity; +import org.eclipse.jpt.core.context.MappedSuperclass; import org.eclipse.jpt.core.internal.context.java.JavaNullTypeMapping; -import org.eclipse.jpt.core.internal.resource.java.IdClass; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.MappedSuperclass; +import org.eclipse.jpt.core.resource.java.IdClass; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -55,14 +55,14 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); mappedSuperclass.setIdClass("myIdClass"); - javaPersistentType().setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY); - assertTrue(javaPersistentType().getMapping() instanceof IEntity); + javaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY); + assertTrue(javaPersistentType().getMapping() instanceof Entity); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.mappingAnnotation(MappedSuperclass.ANNOTATION_NAME)); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + assertNull(typeResource.mappingAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME)); assertNotNull(typeResource.annotation(IdClass.ANNOTATION_NAME)); } @@ -70,14 +70,14 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); mappedSuperclass.setIdClass("myIdClass"); - javaPersistentType().setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); - assertTrue(javaPersistentType().getMapping() instanceof IEmbeddable); + javaPersistentType().setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); + assertTrue(javaPersistentType().getMapping() instanceof Embeddable); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.mappingAnnotation(MappedSuperclass.ANNOTATION_NAME)); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + assertNull(typeResource.mappingAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME)); assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME)); } @@ -85,14 +85,14 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); mappedSuperclass.setIdClass("myIdClass"); - javaPersistentType().setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY); + javaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY); assertTrue(javaPersistentType().getMapping() instanceof JavaNullTypeMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - assertNull(typeResource.mappingAnnotation(MappedSuperclass.ANNOTATION_NAME)); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + assertNull(typeResource.mappingAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME)); assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME)); } @@ -100,14 +100,14 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase public void testMappedSuperclass() throws Exception { createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertTrue(javaPersistentType().getMapping() instanceof IMappedSuperclass); + assertTrue(javaPersistentType().getMapping() instanceof MappedSuperclass); } public void testOverridableAttributeNames() throws Exception { createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); Iterator<String> overridableAttributeNames = mappedSuperclass.overridableAttributeNames(); assertEquals("id", overridableAttributeNames.next()); assertEquals("name", overridableAttributeNames.next()); @@ -118,7 +118,7 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); Iterator<String> overridableAssociationNames = mappedSuperclass.overridableAssociationNames(); assertFalse(overridableAssociationNames.hasNext()); } @@ -127,7 +127,7 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); assertFalse(mappedSuperclass.tableNameIsInvalid(FULLY_QUALIFIED_TYPE_NAME)); assertFalse(mappedSuperclass.tableNameIsInvalid("FOO")); @@ -137,7 +137,7 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); assertFalse(mappedSuperclass.associatedTables().hasNext()); } @@ -146,7 +146,7 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); assertFalse(mappedSuperclass.associatedTablesIncludingInherited().hasNext()); } @@ -155,7 +155,7 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); assertFalse(mappedSuperclass.associatedTableNamesIncludingInherited().hasNext()); } @@ -164,7 +164,7 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); Iterator<String> overridableAttributeNames = mappedSuperclass.overridableAttributeNames(); assertEquals("id", overridableAttributeNames.next()); assertEquals("name", overridableAttributeNames.next()); @@ -176,7 +176,7 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); Iterator<String> overridableAssociationNames = mappedSuperclass.overridableAssociationNames(); assertFalse(overridableAssociationNames.hasNext()); } @@ -185,25 +185,25 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); - assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY)); - assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY)); - assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY)); - assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)); - assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY)); - assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY)); - assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY)); - assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY)); - assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY)); - assertTrue(mappedSuperclass.attributeMappingKeyAllowed(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY)); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); + assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY)); + assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY)); + assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY)); + assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)); + assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY)); + assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY)); + assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY)); + assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY)); + assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY)); + assertTrue(mappedSuperclass.attributeMappingKeyAllowed(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY)); } public void testUpdateIdClass() throws Exception { createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); assertNull(mappedSuperclass.getIdClass()); assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME)); @@ -234,8 +234,8 @@ public class JavaMappedSuperclassTests extends ContextModelTestCase createTestMappedSuperclass(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - IMappedSuperclass mappedSuperclass = (IMappedSuperclass) javaPersistentType().getMapping(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + MappedSuperclass mappedSuperclass = (MappedSuperclass) javaPersistentType().getMapping(); assertNull(mappedSuperclass.getIdClass()); assertNull(typeResource.annotation(IdClass.ANNOTATION_NAME)); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java index 2a0deb0efb..bea94d032f 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedNativeQueryTests.java @@ -13,12 +13,12 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.context.base.IEntity; -import org.eclipse.jpt.core.internal.context.base.INamedNativeQuery; -import org.eclipse.jpt.core.internal.context.base.IQueryHint; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.NamedNativeQuery; +import org.eclipse.jpt.core.context.Entity; +import org.eclipse.jpt.core.context.NamedNativeQuery; +import org.eclipse.jpt.core.context.QueryHint; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -72,11 +72,11 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + Entity entity = javaEntity(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_NAME, javaNamedNativeQuery.getName()); assertEquals(QUERY_NAME, namedNativeQuery.getName()); @@ -95,11 +95,11 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase public void testModifyName() throws Exception { createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + Entity entity = javaEntity(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_NAME, javaNamedNativeQuery.getName()); assertEquals(QUERY_NAME, namedNativeQuery.getName()); @@ -119,11 +119,11 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + Entity entity = javaEntity(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_QUERY, javaNamedNativeQuery.getQuery()); assertEquals(QUERY_QUERY, namedNativeQuery.getQuery()); @@ -142,11 +142,11 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase public void testModifyQuery() throws Exception { createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + Entity entity = javaEntity(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_QUERY, javaNamedNativeQuery.getQuery()); assertEquals(QUERY_QUERY, namedNativeQuery.getQuery()); @@ -166,21 +166,21 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase public void testAddHint() throws Exception { createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + Entity entity = javaEntity(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); - IQueryHint queryHint = namedNativeQuery.addHint(0); + QueryHint queryHint = namedNativeQuery.addHint(0); ormResource().save(null); queryHint.setName("FOO"); ormResource().save(null); assertEquals("FOO", javaNamedNativeQuery.hintAt(0).getName()); - IQueryHint queryHint2 = namedNativeQuery.addHint(0); + QueryHint queryHint2 = namedNativeQuery.addHint(0); ormResource().save(null); queryHint2.setName("BAR"); ormResource().save(null); @@ -188,7 +188,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase assertEquals("BAR", javaNamedNativeQuery.hintAt(0).getName()); assertEquals("FOO", javaNamedNativeQuery.hintAt(1).getName()); - IQueryHint queryHint3 = namedNativeQuery.addHint(1); + QueryHint queryHint3 = namedNativeQuery.addHint(1); ormResource().save(null); queryHint3.setName("BAZ"); ormResource().save(null); @@ -197,7 +197,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase assertEquals("BAZ", javaNamedNativeQuery.hintAt(1).getName()); assertEquals("FOO", javaNamedNativeQuery.hintAt(2).getName()); - ListIterator<IQueryHint> hints = namedNativeQuery.hints(); + ListIterator<QueryHint> hints = namedNativeQuery.hints(); assertEquals(queryHint2, hints.next()); assertEquals(queryHint3, hints.next()); assertEquals(queryHint, hints.next()); @@ -211,11 +211,11 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase public void testRemoveHint() throws Exception { createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + Entity entity = javaEntity(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); namedNativeQuery.addHint(0).setName("FOO"); namedNativeQuery.addHint(1).setName("BAR"); @@ -239,11 +239,11 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase public void testMoveHint() throws Exception { createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + Entity entity = javaEntity(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); namedNativeQuery.addHint(0).setName("FOO"); namedNativeQuery.addHint(1).setName("BAR"); @@ -253,7 +253,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase namedNativeQuery.moveHint(2, 0); - ListIterator<IQueryHint> hints = namedNativeQuery.hints(); + ListIterator<QueryHint> hints = namedNativeQuery.hints(); assertEquals("BAR", hints.next().getName()); assertEquals("BAZ", hints.next().getName()); assertEquals("FOO", hints.next().getName()); @@ -277,11 +277,11 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase public void testUpdateHints() throws Exception { createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + Entity entity = javaEntity(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); javaNamedNativeQuery.addHint(0); javaNamedNativeQuery.addHint(1); @@ -291,7 +291,7 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase javaNamedNativeQuery.hintAt(1).setName("BAR"); javaNamedNativeQuery.hintAt(2).setName("BAZ"); - ListIterator<IQueryHint> hints = namedNativeQuery.hints(); + ListIterator<QueryHint> hints = namedNativeQuery.hints(); assertEquals("FOO", hints.next().getName()); assertEquals("BAR", hints.next().getName()); assertEquals("BAZ", hints.next().getName()); @@ -329,13 +329,13 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase public void testHintsSize() throws Exception { createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); + Entity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); assertEquals(0, namedNativeQuery.hintsSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); javaNamedNativeQuery.addHint(0); @@ -353,11 +353,11 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + Entity entity = javaEntity(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(null, javaNamedNativeQuery.getResultClass()); assertEquals(null, namedNativeQuery.getResultClass()); @@ -376,11 +376,11 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase public void testModifyResultClass() throws Exception { createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + Entity entity = javaEntity(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(null, javaNamedNativeQuery.getResultClass()); assertEquals(null, namedNativeQuery.getResultClass()); @@ -400,11 +400,11 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + Entity entity = javaEntity(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(null, javaNamedNativeQuery.getResultSetMapping()); assertEquals(null, namedNativeQuery.getResultSetMapping()); @@ -423,11 +423,11 @@ public class JavaNamedNativeQueryTests extends ContextModelTestCase public void testModifyResultSetMapping() throws Exception { createTestEntityWithNamedNativeQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); + Entity entity = javaEntity(); + NamedNativeQuery namedNativeQuery = entity.namedNativeQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedNativeQuery javaNamedNativeQuery = (NamedNativeQuery) typeResource.annotation(NamedNativeQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedNativeQueryAnnotation javaNamedNativeQuery = (NamedNativeQueryAnnotation) typeResource.annotation(NamedNativeQueryAnnotation.ANNOTATION_NAME); assertEquals(null, javaNamedNativeQuery.getResultSetMapping()); assertEquals(null, namedNativeQuery.getResultSetMapping()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java index 50b50871bb..08da14cdfc 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaNamedQueryTests.java @@ -13,12 +13,12 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.context.base.IEntity; -import org.eclipse.jpt.core.internal.context.base.INamedQuery; -import org.eclipse.jpt.core.internal.context.base.IQueryHint; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.NamedQuery; +import org.eclipse.jpt.core.context.Entity; +import org.eclipse.jpt.core.context.NamedQuery; +import org.eclipse.jpt.core.context.QueryHint; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -72,11 +72,11 @@ public class JavaNamedQueryTests extends ContextModelTestCase createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedQuery namedQuery = entity.namedQueries().next(); + Entity entity = javaEntity(); + NamedQuery namedQuery = entity.namedQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_NAME, javaNamedQuery.getName()); assertEquals(QUERY_NAME, namedQuery.getName()); @@ -95,11 +95,11 @@ public class JavaNamedQueryTests extends ContextModelTestCase public void testModifyName() throws Exception { createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedQuery namedQuery = entity.namedQueries().next(); + Entity entity = javaEntity(); + NamedQuery namedQuery = entity.namedQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_NAME, javaNamedQuery.getName()); assertEquals(QUERY_NAME, namedQuery.getName()); @@ -119,11 +119,11 @@ public class JavaNamedQueryTests extends ContextModelTestCase createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedQuery namedQuery = entity.namedQueries().next(); + Entity entity = javaEntity(); + NamedQuery namedQuery = entity.namedQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_QUERY, javaNamedQuery.getQuery()); assertEquals(QUERY_QUERY, namedQuery.getQuery()); @@ -142,11 +142,11 @@ public class JavaNamedQueryTests extends ContextModelTestCase public void testModifyQuery() throws Exception { createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedQuery namedQuery = entity.namedQueries().next(); + Entity entity = javaEntity(); + NamedQuery namedQuery = entity.namedQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME); assertEquals(QUERY_QUERY, javaNamedQuery.getQuery()); assertEquals(QUERY_QUERY, namedQuery.getQuery()); @@ -166,21 +166,21 @@ public class JavaNamedQueryTests extends ContextModelTestCase public void testAddHint() throws Exception { createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedQuery namedQuery = entity.namedQueries().next(); + Entity entity = javaEntity(); + NamedQuery namedQuery = entity.namedQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME); - IQueryHint queryHint = namedQuery.addHint(0); + QueryHint queryHint = namedQuery.addHint(0); ormResource().save(null); queryHint.setName("FOO"); ormResource().save(null); assertEquals("FOO", javaNamedQuery.hintAt(0).getName()); - IQueryHint queryHint2 = namedQuery.addHint(0); + QueryHint queryHint2 = namedQuery.addHint(0); ormResource().save(null); queryHint2.setName("BAR"); ormResource().save(null); @@ -188,7 +188,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase assertEquals("BAR", javaNamedQuery.hintAt(0).getName()); assertEquals("FOO", javaNamedQuery.hintAt(1).getName()); - IQueryHint queryHint3 = namedQuery.addHint(1); + QueryHint queryHint3 = namedQuery.addHint(1); ormResource().save(null); queryHint3.setName("BAZ"); ormResource().save(null); @@ -197,7 +197,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase assertEquals("BAZ", javaNamedQuery.hintAt(1).getName()); assertEquals("FOO", javaNamedQuery.hintAt(2).getName()); - ListIterator<IQueryHint> hints = namedQuery.hints(); + ListIterator<QueryHint> hints = namedQuery.hints(); assertEquals(queryHint2, hints.next()); assertEquals(queryHint3, hints.next()); assertEquals(queryHint, hints.next()); @@ -211,11 +211,11 @@ public class JavaNamedQueryTests extends ContextModelTestCase public void testRemoveHint() throws Exception { createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedQuery namedQuery = entity.namedQueries().next(); + Entity entity = javaEntity(); + NamedQuery namedQuery = entity.namedQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME); namedQuery.addHint(0).setName("FOO"); namedQuery.addHint(1).setName("BAR"); @@ -239,11 +239,11 @@ public class JavaNamedQueryTests extends ContextModelTestCase public void testMoveHint() throws Exception { createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedQuery namedQuery = entity.namedQueries().next(); + Entity entity = javaEntity(); + NamedQuery namedQuery = entity.namedQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME); namedQuery.addHint(0).setName("FOO"); namedQuery.addHint(1).setName("BAR"); @@ -253,7 +253,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase namedQuery.moveHint(2, 0); - ListIterator<IQueryHint> hints = namedQuery.hints(); + ListIterator<QueryHint> hints = namedQuery.hints(); assertEquals("BAR", hints.next().getName()); assertEquals("BAZ", hints.next().getName()); assertEquals("FOO", hints.next().getName()); @@ -277,11 +277,11 @@ public class JavaNamedQueryTests extends ContextModelTestCase public void testUpdateHints() throws Exception { createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - INamedQuery namedQuery = entity.namedQueries().next(); + Entity entity = javaEntity(); + NamedQuery namedQuery = entity.namedQueries().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME); javaNamedQuery.addHint(0); javaNamedQuery.addHint(1); @@ -291,7 +291,7 @@ public class JavaNamedQueryTests extends ContextModelTestCase javaNamedQuery.hintAt(1).setName("BAR"); javaNamedQuery.hintAt(2).setName("BAZ"); - ListIterator<IQueryHint> hints = namedQuery.hints(); + ListIterator<QueryHint> hints = namedQuery.hints(); assertEquals("FOO", hints.next().getName()); assertEquals("BAR", hints.next().getName()); assertEquals("BAZ", hints.next().getName()); @@ -329,13 +329,13 @@ public class JavaNamedQueryTests extends ContextModelTestCase public void testHintsSize() throws Exception { createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); + Entity entity = javaEntity(); - INamedQuery namedQuery = entity.namedQueries().next(); + NamedQuery namedQuery = entity.namedQueries().next(); assertEquals(0, namedQuery.hintsSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - NamedQuery javaNamedQuery = (NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + NamedQueryAnnotation javaNamedQuery = (NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME); javaNamedQuery.addHint(0); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java index baece1e695..5eb8b0be8c 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToManyMappingTests.java @@ -13,38 +13,38 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.FetchType; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.ITypeMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType; -import org.eclipse.jpt.core.internal.context.persistence.IClassRef; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.Embedded; -import org.eclipse.jpt.core.internal.resource.java.EmbeddedId; -import org.eclipse.jpt.core.internal.resource.java.Id; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JoinTable; -import org.eclipse.jpt.core.internal.resource.java.ManyToMany; -import org.eclipse.jpt.core.internal.resource.java.ManyToOne; -import org.eclipse.jpt.core.internal.resource.java.MapKey; -import org.eclipse.jpt.core.internal.resource.java.OneToMany; -import org.eclipse.jpt.core.internal.resource.java.OneToOne; -import org.eclipse.jpt.core.internal.resource.java.OrderBy; -import org.eclipse.jpt.core.internal.resource.java.Transient; -import org.eclipse.jpt.core.internal.resource.java.Version; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.FetchType; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.TypeMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.java.JavaPersistentType; +import org.eclipse.jpt.core.context.persistence.ClassRef; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.EmbeddedId; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JoinTableAnnotation; +import org.eclipse.jpt.core.resource.java.ManyToMany; +import org.eclipse.jpt.core.resource.java.ManyToOne; +import org.eclipse.jpt.core.resource.java.MapKey; +import org.eclipse.jpt.core.resource.java.OneToMany; +import org.eclipse.jpt.core.resource.java.OneToOne; +import org.eclipse.jpt.core.resource.java.OrderBy; +import org.eclipse.jpt.core.resource.java.Transient; +import org.eclipse.jpt.core.resource.java.Version; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -196,21 +196,21 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); oneToManyMapping.setOrderBy("asdf"); oneToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(oneToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof BasicMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -218,20 +218,20 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); oneToManyMapping.setOrderBy("asdf"); oneToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(oneToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); assertNull(persistentAttribute.getSpecifiedMapping()); assertTrue(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -239,21 +239,21 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); oneToManyMapping.setOrderBy("asdf"); oneToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(oneToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof VersionMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -261,21 +261,21 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); oneToManyMapping.setOrderBy("asdf"); oneToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(oneToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof IdMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -283,21 +283,21 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); oneToManyMapping.setOrderBy("asdf"); oneToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(oneToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -305,21 +305,21 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); oneToManyMapping.setOrderBy("asdf"); oneToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(oneToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -327,21 +327,21 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); oneToManyMapping.setOrderBy("asdf"); oneToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(oneToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof TransientMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -349,21 +349,21 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); oneToManyMapping.setOrderBy("asdf"); oneToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(oneToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -371,21 +371,21 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); oneToManyMapping.setOrderBy("asdf"); oneToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(oneToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -393,21 +393,21 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); oneToManyMapping.setOrderBy("asdf"); oneToManyMapping.getJoinTable().setSpecifiedName("FOO"); assertFalse(oneToManyMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(JoinTableAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); } @@ -416,11 +416,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(); assertNull(oneToManyMapping.getSpecifiedTargetEntity()); @@ -441,11 +441,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(); assertNull(oneToManyMapping.getSpecifiedTargetEntity()); @@ -466,24 +466,24 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(); assertNull(oneToManyMapping.getSpecifiedFetch()); assertNull(oneToMany.getFetch()); //set fetch in the resource model, verify context model updated - oneToMany.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER); + oneToMany.setFetch(org.eclipse.jpt.core.resource.java.FetchType.EAGER); assertEquals(FetchType.EAGER, oneToManyMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER, oneToMany.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, oneToMany.getFetch()); - oneToMany.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY); + oneToMany.setFetch(org.eclipse.jpt.core.resource.java.FetchType.LAZY); assertEquals(FetchType.LAZY, oneToManyMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, oneToMany.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, oneToMany.getFetch()); //set fetch to null in the resource model @@ -496,11 +496,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(); assertNull(oneToManyMapping.getSpecifiedFetch()); @@ -509,11 +509,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase //set fetch in the context model, verify resource model updated oneToManyMapping.setSpecifiedFetch(FetchType.EAGER); assertEquals(FetchType.EAGER, oneToManyMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER, oneToMany.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, oneToMany.getFetch()); oneToManyMapping.setSpecifiedFetch(FetchType.LAZY); assertEquals(FetchType.LAZY, oneToManyMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, oneToMany.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, oneToMany.getFetch()); //set fetch to null in the context model @@ -526,11 +526,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(); assertNull(oneToManyMapping.getMappedBy()); @@ -551,11 +551,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(); assertNull(oneToManyMapping.getMappedBy()); @@ -579,8 +579,8 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".Address"); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); Iterator<String> attributeNames = oneToManyMapping.candidateMappedByAttributeNames(); assertEquals("id", attributeNames.next()); @@ -607,8 +607,8 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestTargetEntityAddress(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); //targetEntity not in the persistence unit, default still set, handled by validation assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getDefaultTargetEntity()); @@ -621,13 +621,13 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase oneToManyMapping.setSpecifiedTargetEntity("foo"); assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getDefaultTargetEntity()); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef addressClassRef = classRefs.next(); - IJavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType(); + ClassRef addressClassRef = classRefs.next(); + JavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType(); //test target is not an Entity, default target entity still exists, this case handled with validation - addressPersistentType.setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY); + addressPersistentType.setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY); assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getDefaultTargetEntity()); } @@ -637,8 +637,8 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".Address"); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); assertNull(oneToManyMapping.getDefaultTargetEntity()); } @@ -649,8 +649,8 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".Address"); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); assertNull(oneToManyMapping.getDefaultTargetEntity()); } @@ -660,8 +660,8 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestTargetEntityAddress(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); assertEquals(PACKAGE_NAME + ".Address", oneToManyMapping.getTargetEntity()); @@ -677,18 +677,18 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestTargetEntityAddress(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); //targetEntity not in the persistence unit assertNull(oneToManyMapping.getResolvedTargetEntity()); //add targetEntity to the persistence unit, now target entity should resolve addXmlClassRef(PACKAGE_NAME + ".Address"); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef addressClassRef = classRefs.next(); - ITypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping(); + ClassRef addressClassRef = classRefs.next(); + TypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping(); assertEquals(addressTypeMapping, oneToManyMapping.getResolvedTargetEntity()); //test default still the same when specified target entity it set @@ -709,11 +709,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(oneToManyMapping.getMapKey()); assertNull(attributeResource.annotation(MapKey.ANNOTATION_NAME)); @@ -744,11 +744,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(oneToManyMapping.getMapKey()); assertNull(attributeResource.annotation(MapKey.ANNOTATION_NAME)); @@ -769,11 +769,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(oneToManyMapping.getOrderBy()); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); @@ -795,11 +795,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(oneToManyMapping.getOrderBy()); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); @@ -820,11 +820,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertTrue(oneToManyMapping.isNoOrdering()); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); @@ -847,11 +847,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertFalse(oneToManyMapping.isPkOrdering()); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); @@ -874,11 +874,11 @@ public class JavaOneToManyMappingTests extends ContextModelTestCase createTestEntityWithOneToManyMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertFalse(oneToManyMapping.isCustomOrdering()); assertNull(attributeResource.annotation(OrderBy.ANNOTATION_NAME)); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java index 7c507e60a8..00aa54a49b 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaOneToOneMappingTests.java @@ -13,40 +13,40 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.FetchType; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IJoinColumn; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.ITypeMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.java.IJavaJoinColumn; -import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType; -import org.eclipse.jpt.core.internal.context.persistence.IClassRef; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.Embedded; -import org.eclipse.jpt.core.internal.resource.java.EmbeddedId; -import org.eclipse.jpt.core.internal.resource.java.Id; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.JoinColumn; -import org.eclipse.jpt.core.internal.resource.java.JoinColumns; -import org.eclipse.jpt.core.internal.resource.java.ManyToMany; -import org.eclipse.jpt.core.internal.resource.java.ManyToOne; -import org.eclipse.jpt.core.internal.resource.java.OneToMany; -import org.eclipse.jpt.core.internal.resource.java.OneToOne; -import org.eclipse.jpt.core.internal.resource.java.Transient; -import org.eclipse.jpt.core.internal.resource.java.Version; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.FetchType; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.JoinColumn; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.TypeMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.java.JavaJoinColumn; +import org.eclipse.jpt.core.context.java.JavaPersistentType; +import org.eclipse.jpt.core.context.persistence.ClassRef; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.EmbeddedId; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JoinColumns; +import org.eclipse.jpt.core.resource.java.ManyToMany; +import org.eclipse.jpt.core.resource.java.ManyToOne; +import org.eclipse.jpt.core.resource.java.OneToMany; +import org.eclipse.jpt.core.resource.java.OneToOne; +import org.eclipse.jpt.core.resource.java.Transient; +import org.eclipse.jpt.core.resource.java.Version; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.CollectionTools; @@ -200,199 +200,199 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0); assertFalse(oneToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof BasicMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToDefault() throws Exception { createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0); assertFalse(oneToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); assertNull(persistentAttribute.getSpecifiedMapping()); assertTrue(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToVersionMapping() throws Exception { createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0); assertFalse(oneToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof VersionMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToIdMapping() throws Exception { createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0); assertFalse(oneToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof IdMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedMapping() throws Exception { createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0); assertFalse(oneToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToEmbeddedIdMapping() throws Exception { createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0); assertFalse(oneToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToTransientMapping() throws Exception { createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0); assertFalse(oneToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof TransientMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToOneMapping() throws Exception { createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0); assertFalse(oneToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToOneToManyMapping() throws Exception { createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0); assertFalse(oneToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } public void testMorphToManyToManyMapping() throws Exception { createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0); assertFalse(oneToOneMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(JoinColumn.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(JoinColumnAnnotation.ANNOTATION_NAME)); } @@ -400,11 +400,11 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(); assertNull(oneToOneMapping.getSpecifiedTargetEntity()); @@ -425,11 +425,11 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(); assertNull(oneToOneMapping.getSpecifiedTargetEntity()); @@ -450,11 +450,11 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(); assertNull(oneToOneMapping.getMappedBy()); @@ -475,11 +475,11 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(); assertNull(oneToOneMapping.getMappedBy()); @@ -500,11 +500,11 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(); assertNull(oneToOneMapping.getSpecifiedOptional()); @@ -530,11 +530,11 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(); assertNull(oneToOneMapping.getSpecifiedOptional()); @@ -560,24 +560,24 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(); assertNull(oneToOneMapping.getSpecifiedFetch()); assertNull(oneToOne.getFetch()); //set fetch in the resource model, verify context model updated - oneToOne.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER); + oneToOne.setFetch(org.eclipse.jpt.core.resource.java.FetchType.EAGER); assertEquals(FetchType.EAGER, oneToOneMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER, oneToOne.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, oneToOne.getFetch()); - oneToOne.setFetch(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY); + oneToOne.setFetch(org.eclipse.jpt.core.resource.java.FetchType.LAZY); assertEquals(FetchType.LAZY, oneToOneMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, oneToOne.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, oneToOne.getFetch()); //set fetch to null in the resource model @@ -590,11 +590,11 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(); assertNull(oneToOneMapping.getSpecifiedFetch()); @@ -603,11 +603,11 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase //set fetch in the context model, verify resource model updated oneToOneMapping.setSpecifiedFetch(FetchType.EAGER); assertEquals(FetchType.EAGER, oneToOneMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.EAGER, oneToOne.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.EAGER, oneToOne.getFetch()); oneToOneMapping.setSpecifiedFetch(FetchType.LAZY); assertEquals(FetchType.LAZY, oneToOneMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.java.FetchType.LAZY, oneToOne.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.java.FetchType.LAZY, oneToOne.getFetch()); //set fetch to null in the context model @@ -620,24 +620,24 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); - ListIterator<IJavaJoinColumn> specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns(); + ListIterator<JavaJoinColumn> specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns(); assertFalse(specifiedJoinColumns.hasNext()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); //add an annotation to the resource model and verify the context model is updated - JoinColumn joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("FOO"); specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns(); assertEquals("FOO", specifiedJoinColumns.next().getName()); assertFalse(specifiedJoinColumns.hasNext()); - joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("BAR"); specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns(); assertEquals("BAR", specifiedJoinColumns.next().getName()); @@ -645,7 +645,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertFalse(specifiedJoinColumns.hasNext()); - joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("BAZ"); specifiedJoinColumns = oneToOneMapping.specifiedJoinColumns(); assertEquals("BAZ", specifiedJoinColumns.next().getName()); @@ -686,8 +686,8 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); assertEquals(0, oneToOneMapping.specifiedJoinColumnsSize()); @@ -702,8 +702,8 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); assertEquals(1, oneToOneMapping.joinColumnsSize()); @@ -726,20 +726,20 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); oneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("BAR"); oneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Iterator<JavaResource> joinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + Iterator<JavaResourceNode> joinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); - assertEquals("BAZ", ((JoinColumn) joinColumns.next()).getName()); - assertEquals("BAR", ((JoinColumn) joinColumns.next()).getName()); - assertEquals("FOO", ((JoinColumn) joinColumns.next()).getName()); + assertEquals("BAZ", ((JoinColumnAnnotation) joinColumns.next()).getName()); + assertEquals("BAR", ((JoinColumnAnnotation) joinColumns.next()).getName()); + assertEquals("FOO", ((JoinColumnAnnotation) joinColumns.next()).getName()); assertFalse(joinColumns.hasNext()); } @@ -747,54 +747,54 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); oneToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); oneToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Iterator<JavaResource> joinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + Iterator<JavaResourceNode> joinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); - assertEquals("FOO", ((JoinColumn) joinColumns.next()).getName()); - assertEquals("BAR", ((JoinColumn) joinColumns.next()).getName()); - assertEquals("BAZ", ((JoinColumn) joinColumns.next()).getName()); + assertEquals("FOO", ((JoinColumnAnnotation) joinColumns.next()).getName()); + assertEquals("BAR", ((JoinColumnAnnotation) joinColumns.next()).getName()); + assertEquals("BAZ", ((JoinColumnAnnotation) joinColumns.next()).getName()); assertFalse(joinColumns.hasNext()); } public void testRemoveSpecifiedJoinColumn() throws Exception { createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); oneToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); oneToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); - assertEquals(3, CollectionTools.size(attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME))); + assertEquals(3, CollectionTools.size(attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME))); oneToOneMapping.removeSpecifiedJoinColumn(1); - Iterator<JavaResource> joinColumnResources = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); - assertEquals("FOO", ((JoinColumn) joinColumnResources.next()).getName()); - assertEquals("BAZ", ((JoinColumn) joinColumnResources.next()).getName()); + Iterator<JavaResourceNode> joinColumnResources = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + assertEquals("FOO", ((JoinColumnAnnotation) joinColumnResources.next()).getName()); + assertEquals("BAZ", ((JoinColumnAnnotation) joinColumnResources.next()).getName()); assertFalse(joinColumnResources.hasNext()); - Iterator<IJoinColumn> joinColumns = oneToOneMapping.specifiedJoinColumns(); + Iterator<JoinColumn> joinColumns = oneToOneMapping.specifiedJoinColumns(); assertEquals("FOO", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); oneToOneMapping.removeSpecifiedJoinColumn(1); - joinColumnResources = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); - assertEquals("FOO", ((JoinColumn) joinColumnResources.next()).getName()); + joinColumnResources = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + assertEquals("FOO", ((JoinColumnAnnotation) joinColumnResources.next()).getName()); assertFalse(joinColumnResources.hasNext()); joinColumns = oneToOneMapping.specifiedJoinColumns(); @@ -803,7 +803,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.removeSpecifiedJoinColumn(0); - joinColumnResources = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + joinColumnResources = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); assertFalse(joinColumnResources.hasNext()); joinColumns = oneToOneMapping.specifiedJoinColumns(); assertFalse(joinColumns.hasNext()); @@ -815,26 +815,26 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); oneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); oneToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); oneToOneMapping.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ"); - JavaPersistentAttributeResource attributeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME).attributes().next(); + JavaResourcePersistentAttribute attributeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME).attributes().next(); - ListIterator<JoinColumn> javaJoinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + ListIterator<JoinColumnAnnotation> javaJoinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); assertEquals(3, CollectionTools.size(javaJoinColumns)); oneToOneMapping.moveSpecifiedJoinColumn(2, 0); - ListIterator<IJoinColumn> primaryKeyJoinColumns = oneToOneMapping.specifiedJoinColumns(); + ListIterator<JoinColumn> primaryKeyJoinColumns = oneToOneMapping.specifiedJoinColumns(); assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaJoinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + javaJoinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); assertEquals("BAR", javaJoinColumns.next().getName()); assertEquals("BAZ", javaJoinColumns.next().getName()); assertEquals("FOO", javaJoinColumns.next().getName()); @@ -846,7 +846,7 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName()); assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName()); - javaJoinColumns = attributeResource.annotations(JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + javaJoinColumns = attributeResource.annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); assertEquals("BAZ", javaJoinColumns.next().getName()); assertEquals("BAR", javaJoinColumns.next().getName()); assertEquals("FOO", javaJoinColumns.next().getName()); @@ -856,15 +856,15 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); - JavaPersistentAttributeResource attributeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME).attributes().next(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); + JavaResourcePersistentAttribute attributeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME).attributes().next(); - ((JoinColumn) attributeResource.addAnnotation(0, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("FOO"); - ((JoinColumn) attributeResource.addAnnotation(1, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("BAR"); - ((JoinColumn) attributeResource.addAnnotation(2, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("BAZ"); + ((JoinColumnAnnotation) attributeResource.addAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("FOO"); + ((JoinColumnAnnotation) attributeResource.addAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("BAR"); + ((JoinColumnAnnotation) attributeResource.addAnnotation(2, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME)).setName("BAZ"); - ListIterator<IJoinColumn> joinColumns = oneToOneMapping.specifiedJoinColumns(); + ListIterator<JoinColumn> joinColumns = oneToOneMapping.specifiedJoinColumns(); assertEquals("FOO", joinColumns.next().getName()); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); @@ -884,18 +884,18 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase assertEquals("FOO", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); - attributeResource.removeAnnotation(1, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + attributeResource.removeAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); joinColumns = oneToOneMapping.specifiedJoinColumns(); assertEquals("BAZ", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); - attributeResource.removeAnnotation(1, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + attributeResource.removeAnnotation(1, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); joinColumns = oneToOneMapping.specifiedJoinColumns(); assertEquals("BAZ", joinColumns.next().getName()); assertFalse(joinColumns.hasNext()); - attributeResource.removeAnnotation(0, JoinColumn.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); + attributeResource.removeAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumns.ANNOTATION_NAME); joinColumns = oneToOneMapping.specifiedJoinColumns(); assertFalse(joinColumns.hasNext()); } @@ -904,13 +904,13 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestEntityWithOneToOneMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); assertTrue(oneToOneMapping.getDefaultJoinColumn().isVirtual()); oneToOneMapping.addSpecifiedJoinColumn(0); - IJoinColumn specifiedJoinColumn = oneToOneMapping.specifiedJoinColumns().next(); + JoinColumn specifiedJoinColumn = oneToOneMapping.specifiedJoinColumns().next(); assertFalse(specifiedJoinColumn.isVirtual()); assertNull(oneToOneMapping.getDefaultJoinColumn()); @@ -922,8 +922,8 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".Address"); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); Iterator<String> attributeNames = oneToOneMapping.candidateMappedByAttributeNames(); assertEquals("id", attributeNames.next()); @@ -950,8 +950,8 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestTargetEntityAddress(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); //targetEntity not in the persistence unit, default still set, handled by validation assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getDefaultTargetEntity()); @@ -964,13 +964,13 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.setSpecifiedTargetEntity("foo"); assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getDefaultTargetEntity()); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef addressClassRef = classRefs.next(); - IJavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType(); + ClassRef addressClassRef = classRefs.next(); + JavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType(); //test target is not an Entity, default target entity still exists, this case handled with validation - addressPersistentType.setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY); + addressPersistentType.setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY); assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getDefaultTargetEntity()); } @@ -980,8 +980,8 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".Address"); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); assertNull(oneToOneMapping.getDefaultTargetEntity()); } @@ -992,8 +992,8 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".Address"); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); assertNull(oneToOneMapping.getDefaultTargetEntity()); } @@ -1003,8 +1003,8 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestTargetEntityAddress(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); assertEquals(PACKAGE_NAME + ".Address", oneToOneMapping.getTargetEntity()); @@ -1020,18 +1020,18 @@ public class JavaOneToOneMappingTests extends ContextModelTestCase createTestTargetEntityAddress(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) persistentAttribute.getMapping(); //targetEntity not in the persistence unit assertNull(oneToOneMapping.getResolvedTargetEntity()); //add targetEntity to the persistence unit, now target entity should resolve addXmlClassRef(PACKAGE_NAME + ".Address"); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef addressClassRef = classRefs.next(); - ITypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping(); + ClassRef addressClassRef = classRefs.next(); + TypeMapping addressTypeMapping = addressClassRef.getJavaPersistentType().getMapping(); assertEquals(addressTypeMapping, oneToOneMapping.getResolvedTargetEntity()); //test default still the same when specified target entity it set diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentAttributeTests.java index d76e250805..61e9a0e0fe 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentAttributeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentAttributeTests.java @@ -12,17 +12,17 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.IJavaBasicMapping; -import org.eclipse.jpt.core.internal.context.java.IJavaEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.java.IJavaIdMapping; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.Embedded; -import org.eclipse.jpt.core.internal.resource.java.Id; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.java.JavaBasicMapping; +import org.eclipse.jpt.core.context.java.JavaEmbeddedMapping; +import org.eclipse.jpt.core.context.java.JavaIdMapping; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -84,7 +84,7 @@ public class JavaPersistentAttributeTests extends ContextModelTestCase createTestType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); assertEquals("id", persistentAttribute.getName()); } @@ -93,19 +93,19 @@ public class JavaPersistentAttributeTests extends ContextModelTestCase createTestEntityAnnotatedMethod(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - assertTrue(persistentAttribute.getMapping() instanceof IJavaIdMapping); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + assertTrue(persistentAttribute.getMapping() instanceof JavaIdMapping); persistentAttribute.setSpecifiedMappingKey(null); - assertTrue(persistentAttribute.getMapping() instanceof IJavaBasicMapping); + assertTrue(persistentAttribute.getMapping() instanceof JavaBasicMapping); } public void testGetSpecifiedMapping() throws Exception { createTestEntityAnnotatedMethod(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - assertTrue(persistentAttribute.getSpecifiedMapping() instanceof IJavaIdMapping); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + assertTrue(persistentAttribute.getSpecifiedMapping() instanceof JavaIdMapping); persistentAttribute.setSpecifiedMappingKey(null); assertNull(persistentAttribute.getSpecifiedMapping()); @@ -115,7 +115,7 @@ public class JavaPersistentAttributeTests extends ContextModelTestCase createTestType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); assertNull(persistentAttribute.getSpecifiedMapping()); assertNotNull(persistentAttribute.getMapping()); @@ -125,71 +125,71 @@ public class JavaPersistentAttributeTests extends ContextModelTestCase createTestEntityAnnotatedMethod(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); + assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); persistentAttribute.setSpecifiedMappingKey(null); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); } public void testDefaultMappingKey() throws Exception { createTestEntityAnnotatedMethod(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.defaultMappingKey()); + assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.defaultMappingKey()); } public void testSetSpecifiedMappingKey() throws Exception { createTestType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); assertNull(persistentAttribute.getSpecifiedMapping()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNotNull(attributeResource.mappingAnnotation()); assertTrue(attributeResource.mappingAnnotation() instanceof Embedded); - assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); - assertTrue(persistentAttribute.getSpecifiedMapping() instanceof IJavaEmbeddedMapping); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); + assertTrue(persistentAttribute.getSpecifiedMapping() instanceof JavaEmbeddedMapping); } public void testSetSpecifiedMappingKey2() throws Exception { createTestEntityAnnotatedField(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNotNull(attributeResource.mappingAnnotation()); assertTrue(attributeResource.mappingAnnotation() instanceof Embedded); - assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); - assertTrue(persistentAttribute.getSpecifiedMapping() instanceof IJavaEmbeddedMapping); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); + assertTrue(persistentAttribute.getSpecifiedMapping() instanceof JavaEmbeddedMapping); } public void testSetSpecifiedMappingKeyNull() throws Exception { createTestEntityAnnotatedMethod(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation()); assertNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); @@ -200,27 +200,27 @@ public class JavaPersistentAttributeTests extends ContextModelTestCase createTestEntityAnnotatedField(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); attributeResource.setMappingAnnotation(Embedded.ANNOTATION_NAME); - assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.mappingKey()); } public void testGetMappingKeyMappingChangeInResourceModel2() throws Exception { createTestType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); assertNull(persistentAttribute.getSpecifiedMapping()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); attributeResource.setMappingAnnotation(Basic.ANNOTATION_NAME); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getSpecifiedMapping().getKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getSpecifiedMapping().getKey()); } } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentTypeTests.java index ee95767947..d432922179 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentTypeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPersistentTypeTests.java @@ -13,21 +13,21 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.AccessType; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.IPersistentType; -import org.eclipse.jpt.core.internal.context.java.IJavaPersistentAttribute; -import org.eclipse.jpt.core.internal.context.java.IJavaPersistentType; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.persistence.IClassRef; -import org.eclipse.jpt.core.internal.resource.java.Embeddable; -import org.eclipse.jpt.core.internal.resource.java.Entity; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.AccessType; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.PersistentType; +import org.eclipse.jpt.core.context.java.JavaPersistentAttribute; +import org.eclipse.jpt.core.context.java.JavaPersistentType; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.context.persistence.ClassRef; +import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation; +import org.eclipse.jpt.core.resource.java.EntityAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -268,11 +268,11 @@ public class JavaPersistentTypeTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef classRef = classRefs.next(); + ClassRef classRef = classRefs.next(); - IJavaPersistentType javaPersistentType = classRef.getJavaPersistentType(); + JavaPersistentType javaPersistentType = classRef.getJavaPersistentType(); assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName()); assertEquals(AccessType.PROPERTY, javaPersistentType.access()); @@ -285,11 +285,11 @@ public class JavaPersistentTypeTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef classRef = classRefs.next(); + ClassRef classRef = classRefs.next(); - IJavaPersistentType javaPersistentType = classRef.getJavaPersistentType(); + JavaPersistentType javaPersistentType = classRef.getJavaPersistentType(); assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName()); assertEquals(AccessType.FIELD, javaPersistentType.access()); @@ -302,11 +302,11 @@ public class JavaPersistentTypeTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef classRef = classRefs.next(); + ClassRef classRef = classRefs.next(); - IJavaPersistentType javaPersistentType = classRef.getJavaPersistentType(); + JavaPersistentType javaPersistentType = classRef.getJavaPersistentType(); assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName()); assertEquals(AccessType.PROPERTY, javaPersistentType.access()); @@ -319,10 +319,10 @@ public class JavaPersistentTypeTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef classRef = classRefs.next(); - IJavaPersistentType javaPersistentType = classRef.getJavaPersistentType(); + ClassRef classRef = classRefs.next(); + JavaPersistentType javaPersistentType = classRef.getJavaPersistentType(); assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName()); @@ -338,10 +338,10 @@ public class JavaPersistentTypeTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); classRefs.next(); - IClassRef classRef = classRefs.next(); - IJavaPersistentType javaPersistentType = classRef.getJavaPersistentType(); + ClassRef classRef = classRefs.next(); + JavaPersistentType javaPersistentType = classRef.getJavaPersistentType(); assertEquals(PACKAGE_NAME + ".AnnotationTestTypeChild", javaPersistentType.getName()); @@ -349,17 +349,17 @@ public class JavaPersistentTypeTests extends ContextModelTestCase } public void testAccessXmlNoAccessNoAnnotations() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); createTestEntity(); - IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); + JavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); assertEquals(AccessType.FIELD, javaPersistentType.access()); } public void testAccessXmlEntityAccessNoAnnotations() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); createTestEntity(); - IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); + JavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); entityPersistentType.getMapping().setSpecifiedAccess(AccessType.FIELD); assertEquals(AccessType.FIELD, javaPersistentType.access()); @@ -369,9 +369,9 @@ public class JavaPersistentTypeTests extends ContextModelTestCase } public void testAccessXmlPersistentUnitDefaultsAccessNoAnnotations() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); createTestEntity(); - IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); + JavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD); assertEquals(AccessType.FIELD, javaPersistentType.access()); @@ -382,9 +382,9 @@ public class JavaPersistentTypeTests extends ContextModelTestCase public void testAccessXmlEntityPropertyAccessAndFieldAnnotations() throws Exception { //xml access set to property, field annotations, JavaPersistentType access is property - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); createTestEntityAnnotatedField(); - IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); + JavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); entityPersistentType.getMapping().setSpecifiedAccess(AccessType.PROPERTY); assertEquals(AccessType.PROPERTY, javaPersistentType.access()); @@ -392,18 +392,18 @@ public class JavaPersistentTypeTests extends ContextModelTestCase public void testAccessXmlEntityFieldAccessAndPropertyAnnotations() throws Exception { //xml access set to field, property annotations, JavaPersistentType access is field - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); createTestEntityAnnotatedMethod(); - IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); + JavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); entityPersistentType.getMapping().setSpecifiedAccess(AccessType.FIELD); assertEquals(AccessType.FIELD, javaPersistentType.access()); } public void testAccessXmlPersistentUnitDefaultsAccessFieldAnnotations() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); createTestEntityAnnotatedField(); - IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); + JavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY); assertEquals(AccessType.FIELD, javaPersistentType.access()); @@ -411,12 +411,12 @@ public class JavaPersistentTypeTests extends ContextModelTestCase //inheritance wins over entity-mappings specified access public void testAccessXmlEntityMappingsAccessWithInheritance() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentType childEntityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType childEntityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); createTestEntityAnnotatedMethod(); createTestSubType(); - IJavaPersistentType childJavaPersistentType = childEntityPersistentType.javaPersistentType(); + JavaPersistentType childJavaPersistentType = childEntityPersistentType.javaPersistentType(); entityMappings().setSpecifiedAccess(AccessType.FIELD); assertEquals(AccessType.PROPERTY, entityPersistentType.javaPersistentType().access()); @@ -426,9 +426,9 @@ public class JavaPersistentTypeTests extends ContextModelTestCase public void testAccessXmlMetadataCompleteFieldAnnotations() throws Exception { //xml access set to property, so even though there are field annotations, JavaPersistentType //access should be property - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); createTestEntityAnnotatedField(); - IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); + JavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY); entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true); @@ -439,9 +439,9 @@ public class JavaPersistentTypeTests extends ContextModelTestCase public void testAccessNoXmlAccessXmlMetdataCompletePropertyAnnotations() throws Exception { //xml access not set, metadata complete set. JavaPersistentType access //is field?? - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); createTestEntityAnnotatedMethod(); - IJavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); + JavaPersistentType javaPersistentType = entityPersistentType.javaPersistentType(); entityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true); assertEquals(AccessType.FIELD, javaPersistentType.access()); @@ -454,12 +454,12 @@ public class JavaPersistentTypeTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); - IClassRef classRef = classRefs.next(); - IJavaPersistentType rootJavaPersistentType = classRef.getJavaPersistentType(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ClassRef classRef = classRefs.next(); + JavaPersistentType rootJavaPersistentType = classRef.getJavaPersistentType(); classRef = classRefs.next(); - IJavaPersistentType childJavaPersistentType = classRef.getJavaPersistentType(); + JavaPersistentType childJavaPersistentType = classRef.getJavaPersistentType(); assertEquals(rootJavaPersistentType, childJavaPersistentType.parentPersistentType()); assertNull(rootJavaPersistentType.parentPersistentType()); @@ -473,8 +473,8 @@ public class JavaPersistentTypeTests extends ContextModelTestCase //annotation it should not be found as the parentPersistentType addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild"); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); - IJavaPersistentType javaPersistentType = classRefs.next().getJavaPersistentType(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + JavaPersistentType javaPersistentType = classRefs.next().getJavaPersistentType(); assertNull(javaPersistentType.parentPersistentType()); } @@ -488,12 +488,12 @@ public class JavaPersistentTypeTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2"); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); - IClassRef classRef = classRefs.next(); - IJavaPersistentType rootJavaPersistentType = classRef.getJavaPersistentType(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + ClassRef classRef = classRefs.next(); + JavaPersistentType rootJavaPersistentType = classRef.getJavaPersistentType(); classRef = classRefs.next(); - IJavaPersistentType childJavaPersistentType = classRef.getJavaPersistentType(); + JavaPersistentType childJavaPersistentType = classRef.getJavaPersistentType(); assertEquals(rootJavaPersistentType, childJavaPersistentType.parentPersistentType()); assertNull(rootJavaPersistentType.parentPersistentType()); @@ -507,11 +507,11 @@ public class JavaPersistentTypeTests extends ContextModelTestCase addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2"); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); - IJavaPersistentType rootJavaPersistentType = classRefs.next().getJavaPersistentType(); - IJavaPersistentType childJavaPersistentType = classRefs.next().getJavaPersistentType(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + JavaPersistentType rootJavaPersistentType = classRefs.next().getJavaPersistentType(); + JavaPersistentType childJavaPersistentType = classRefs.next().getJavaPersistentType(); - Iterator<IPersistentType> inheritanceHierarchy = childJavaPersistentType.inheritanceHierarchy(); + Iterator<PersistentType> inheritanceHierarchy = childJavaPersistentType.inheritanceHierarchy(); assertEquals(childJavaPersistentType, inheritanceHierarchy.next()); assertEquals(rootJavaPersistentType, inheritanceHierarchy.next()); @@ -525,11 +525,11 @@ public class JavaPersistentTypeTests extends ContextModelTestCase addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2"); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<IClassRef> classRefs = persistenceUnit().specifiedClassRefs(); - IJavaPersistentType childJavaPersistentType = classRefs.next().getJavaPersistentType(); - IJavaPersistentType rootJavaPersistentType = classRefs.next().getJavaPersistentType(); + ListIterator<ClassRef> classRefs = persistenceUnit().specifiedClassRefs(); + JavaPersistentType childJavaPersistentType = classRefs.next().getJavaPersistentType(); + JavaPersistentType rootJavaPersistentType = classRefs.next().getJavaPersistentType(); - Iterator<IPersistentType> inheritanceHierarchy = childJavaPersistentType.inheritanceHierarchy(); + Iterator<PersistentType> inheritanceHierarchy = childJavaPersistentType.inheritanceHierarchy(); assertEquals(childJavaPersistentType, inheritanceHierarchy.next()); assertEquals(rootJavaPersistentType, inheritanceHierarchy.next()); @@ -539,97 +539,97 @@ public class JavaPersistentTypeTests extends ContextModelTestCase createTestEntityAnnotatedMethod(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().getMapping().getKey()); + assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().getMapping().getKey()); } public void testGetMappingNull() throws Exception { createTestType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(IMappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().getMapping().getKey()); + assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().getMapping().getKey()); } public void testMappingKey() throws Exception { createTestEntityAnnotatedMethod(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); + assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); } public void testMappingKeyNull() throws Exception { createTestType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(IMappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); + assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); } public void testSetMappingKey() throws Exception { createTestType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(IMappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); + assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); - javaPersistentType().setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY); + javaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); assertNotNull(typeResource.mappingAnnotation()); - assertTrue(typeResource.mappingAnnotation() instanceof Entity); + assertTrue(typeResource.mappingAnnotation() instanceof EntityAnnotation); - assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); + assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); } public void testSetMappingKey2() throws Exception { createTestEntityAnnotatedField(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); + assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); - javaPersistentType().setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); + javaPersistentType().setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); assertNotNull(typeResource.mappingAnnotation()); - assertTrue(typeResource.mappingAnnotation() instanceof Embeddable); + assertTrue(typeResource.mappingAnnotation() instanceof EmbeddableAnnotation); - assertEquals(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); + assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); } public void testSetMappingKeyNull() throws Exception { createTestEntityAnnotatedMethod(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); + assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); - javaPersistentType().setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY); + javaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); assertNull(typeResource.mappingAnnotation()); - assertNull(typeResource.mappingAnnotation(Entity.ANNOTATION_NAME)); + assertNull(typeResource.mappingAnnotation(EntityAnnotation.ANNOTATION_NAME)); - assertEquals(IMappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); + assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); } public void testGetMappingKeyMappingChangeInResourceModel() throws Exception { createTestEntityAnnotatedField(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); + assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - typeResource.setMappingAnnotation(Embeddable.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + typeResource.setMappingAnnotation(EmbeddableAnnotation.ANNOTATION_NAME); - assertEquals(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); + assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); } public void testGetMappingKeyMappingChangeInResourceModel2() throws Exception { createTestType(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - assertEquals(IMappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); + assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - typeResource.setMappingAnnotation(Entity.ANNOTATION_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + typeResource.setMappingAnnotation(EntityAnnotation.ANNOTATION_NAME); - assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); + assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, javaPersistentType().mappingKey()); } public void testIsMapped() throws Exception { @@ -638,14 +638,14 @@ public class JavaPersistentTypeTests extends ContextModelTestCase assertTrue(javaPersistentType().isMapped()); - javaPersistentType().setMappingKey(IMappingKeys.NULL_TYPE_MAPPING_KEY); + javaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY); assertFalse(javaPersistentType().isMapped()); } public void testAttributes() throws Exception { createTestEntityAnnotatedMethod(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<IJavaPersistentAttribute> attributes = javaPersistentType().attributes(); + ListIterator<JavaPersistentAttribute> attributes = javaPersistentType().attributes(); assertEquals("id", attributes.next().getName()); assertFalse(attributes.hasNext()); @@ -655,7 +655,7 @@ public class JavaPersistentTypeTests extends ContextModelTestCase createTestEntityAnnotatedFieldAndMethod(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<IJavaPersistentAttribute> attributes = javaPersistentType().attributes(); + ListIterator<JavaPersistentAttribute> attributes = javaPersistentType().attributes(); assertEquals("id", attributes.next().getName()); assertEquals("name", attributes.next().getName()); @@ -680,7 +680,7 @@ public class JavaPersistentTypeTests extends ContextModelTestCase createTestEntityAnnotatedMethod(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute attribute = javaPersistentType().attributeNamed("id"); + PersistentAttribute attribute = javaPersistentType().attributeNamed("id"); assertEquals("id", attribute.getName()); assertNull(javaPersistentType().attributeNamed("name")); @@ -691,7 +691,7 @@ public class JavaPersistentTypeTests extends ContextModelTestCase createTestEntityAnnotatedField(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute attribute = javaPersistentType().attributeNamed("name"); + PersistentAttribute attribute = javaPersistentType().attributeNamed("name"); assertEquals("name", attribute.getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java index 9589f44b43..01d0faba93 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java @@ -12,12 +12,12 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -94,12 +94,12 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertEquals(PRIMARY_KEY_JOIN_COLUMN_NAME, specifiedPkJoinColumn.getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumn pkJoinColumnResource = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); pkJoinColumnResource.setName("FOO"); specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); @@ -110,7 +110,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn pkJoinColumn = javaEntity().getDefaultPrimaryKeyJoinColumn(); + PrimaryKeyJoinColumn pkJoinColumn = javaEntity().getDefaultPrimaryKeyJoinColumn(); assertEquals("id", pkJoinColumn.getDefaultName()); } @@ -120,12 +120,12 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase assertNull(javaEntity().getDefaultPrimaryKeyJoinColumn()); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertEquals("id", specifiedPkJoinColumn.getDefaultName()); //remove @Id annotation - IPersistentAttribute idAttribute = javaPersistentType().attributeNamed("id"); - idAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + PersistentAttribute idAttribute = javaPersistentType().attributeNamed("id"); + idAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); assertNull(specifiedPkJoinColumn.getDefaultName()); } @@ -134,7 +134,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertEquals(PRIMARY_KEY_JOIN_COLUMN_NAME, specifiedPkJoinColumn.getName()); } @@ -142,19 +142,19 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); specifiedPkJoinColumn.setSpecifiedName("foo"); assertEquals("foo", specifiedPkJoinColumn.getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumn pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals("foo", pkJoinColumn.getName()); specifiedPkJoinColumn.setSpecifiedName(null); assertNull(specifiedPkJoinColumn.getSpecifiedName()); - pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNull(pkJoinColumn); } @@ -162,11 +162,11 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertNull(specifiedPkJoinColumn.getColumnDefinition()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); column.setColumnDefinition(COLUMN_DEFINITION); assertEquals(COLUMN_DEFINITION, specifiedPkJoinColumn.getColumnDefinition()); @@ -184,16 +184,16 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); specifiedPkJoinColumn.setColumnDefinition("foo"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals("foo", column.getColumnDefinition()); specifiedPkJoinColumn.setColumnDefinition(null); - column = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + column = (PrimaryKeyJoinColumnAnnotation) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNull(column.getColumnDefinition()); } @@ -201,11 +201,11 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertNull(specifiedPkJoinColumn.getSpecifiedReferencedColumnName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumn pkJoinColumnResource = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); pkJoinColumnResource.setReferencedColumnName("FOO"); specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); @@ -216,7 +216,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn pkJoinColumn = javaEntity().getDefaultPrimaryKeyJoinColumn(); + PrimaryKeyJoinColumn pkJoinColumn = javaEntity().getDefaultPrimaryKeyJoinColumn(); assertEquals("id", pkJoinColumn.getDefaultReferencedColumnName()); } @@ -226,13 +226,13 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase assertNull(javaEntity().getDefaultPrimaryKeyJoinColumn()); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertEquals("id", specifiedPkJoinColumn.getDefaultReferencedColumnName()); //remove @Id annotation - IPersistentAttribute idAttribute = javaPersistentType().attributeNamed("id"); - idAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + PersistentAttribute idAttribute = javaPersistentType().attributeNamed("id"); + idAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); assertNull(specifiedPkJoinColumn.getDefaultReferencedColumnName()); } @@ -241,12 +241,12 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumn pkJoinColumnResource = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + PrimaryKeyJoinColumnAnnotation pkJoinColumnResource = (PrimaryKeyJoinColumnAnnotation) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); pkJoinColumnResource.setReferencedColumnName("FOO"); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertEquals("FOO", specifiedPkJoinColumn.getReferencedColumnName()); } @@ -254,20 +254,20 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); specifiedPkJoinColumn.setSpecifiedReferencedColumnName("foo"); assertEquals("foo", specifiedPkJoinColumn.getSpecifiedReferencedColumnName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - PrimaryKeyJoinColumn pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals("foo", pkJoinColumn.getReferencedColumnName()); specifiedPkJoinColumn.setSpecifiedName(null); specifiedPkJoinColumn.setSpecifiedReferencedColumnName(null); assertNull(specifiedPkJoinColumn.getSpecifiedReferencedColumnName()); - pkJoinColumn = (PrimaryKeyJoinColumn) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNull(pkJoinColumn); } @@ -275,7 +275,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertFalse(specifiedPkJoinColumn.isVirtual()); assertNull(javaEntity().getDefaultPrimaryKeyJoinColumn()); @@ -287,7 +287,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertFalse(specifiedPkJoinColumn.isReferencedColumnResolved()); } @@ -295,7 +295,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertNull(specifiedPkJoinColumn.dbColumn()); } @@ -303,7 +303,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertNull(specifiedPkJoinColumn.dbReferencedColumn()); } @@ -311,7 +311,7 @@ public class JavaPrimaryKeyJoinColumnTests extends ContextModelTestCase createTestEntityWithPrimaryKeyJoinColumn(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = javaEntity().specifiedPrimaryKeyJoinColumns().next(); assertNull(specifiedPkJoinColumn.dbTable()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java index 3c3a7acdcf..24e1e1aee3 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaQueryHintTests.java @@ -12,12 +12,12 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.context.base.IEntity; -import org.eclipse.jpt.core.internal.context.base.IQueryHint; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.NamedQuery; -import org.eclipse.jpt.core.internal.resource.java.QueryHint; +import org.eclipse.jpt.core.context.Entity; +import org.eclipse.jpt.core.context.QueryHint; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation; +import org.eclipse.jpt.core.resource.java.QueryHintAnnotation; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -70,11 +70,11 @@ public class JavaQueryHintTests extends ContextModelTestCase createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - IQueryHint queryHint = entity.namedQueries().next().hints().next(); + Entity entity = javaEntity(); + QueryHint queryHint = entity.namedQueries().next().hints().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - QueryHint javaQueryHint = ((NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME)).hints().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + QueryHintAnnotation javaQueryHint = ((NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next(); assertNull(javaQueryHint.getName()); assertNull(queryHint.getName()); @@ -94,11 +94,11 @@ public class JavaQueryHintTests extends ContextModelTestCase createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - IQueryHint queryHint = entity.namedQueries().next().hints().next(); + Entity entity = javaEntity(); + QueryHint queryHint = entity.namedQueries().next().hints().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - QueryHint javaQueryhint = ((NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME)).hints().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + QueryHintAnnotation javaQueryhint = ((NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next(); assertNull(javaQueryhint.getName()); assertNull(queryHint.getName()); @@ -118,11 +118,11 @@ public class JavaQueryHintTests extends ContextModelTestCase createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - IQueryHint queryHint = entity.namedQueries().next().hints().next(); + Entity entity = javaEntity(); + QueryHint queryHint = entity.namedQueries().next().hints().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - QueryHint javaQueryhint = ((NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME)).hints().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + QueryHintAnnotation javaQueryhint = ((NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next(); assertNull(javaQueryhint.getValue()); assertNull(queryHint.getValue()); @@ -142,11 +142,11 @@ public class JavaQueryHintTests extends ContextModelTestCase createTestEntityWithNamedQuery(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IEntity entity = javaEntity(); - IQueryHint queryHint = entity.namedQueries().next().hints().next(); + Entity entity = javaEntity(); + QueryHint queryHint = entity.namedQueries().next().hints().next(); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - QueryHint javaQueryhint = ((NamedQuery) typeResource.annotation(NamedQuery.ANNOTATION_NAME)).hints().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + QueryHintAnnotation javaQueryhint = ((NamedQueryAnnotation) typeResource.annotation(NamedQueryAnnotation.ANNOTATION_NAME)).hints().next(); assertNull(javaQueryhint.getValue()); assertNull(queryHint.getValue()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java index 974e14a31a..ca6d53be95 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSecondaryTableTests.java @@ -13,16 +13,16 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.IPrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.context.base.ISecondaryTable; -import org.eclipse.jpt.core.internal.context.java.IJavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.resource.java.SecondaryTable; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.PrimaryKeyJoinColumn; +import org.eclipse.jpt.core.context.SecondaryTable; +import org.eclipse.jpt.core.context.java.JavaPrimaryKeyJoinColumn; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation; +import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -100,7 +100,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().secondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().secondaryTables().next(); assertEquals(TABLE_NAME, secondaryTable.getSpecifiedName()); } @@ -108,7 +108,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().secondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().secondaryTables().next(); assertNull(secondaryTable.getDefaultName()); } @@ -116,7 +116,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().secondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().secondaryTables().next(); assertEquals(TABLE_NAME, secondaryTable.getName()); } @@ -124,13 +124,13 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().secondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().secondaryTables().next(); secondaryTable.setSpecifiedName("foo"); assertEquals("foo", javaEntity().secondaryTables().next().getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals("foo", table.getName()); } @@ -139,12 +139,12 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().secondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().secondaryTables().next(); secondaryTable.setSpecifiedName(null); assertEquals(0, javaEntity().secondaryTablesSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); assertNull(typeResource.annotation(JPA.SECONDARY_TABLE)); } @@ -152,8 +152,8 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); table.setName("foo"); assertEquals("foo", javaEntity().secondaryTables().next().getSpecifiedName()); @@ -163,12 +163,12 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTables(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<SecondaryTable> secondaryTableResources = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + ListIterator<SecondaryTableAnnotation> secondaryTableResources = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResources.next().setCatalog("foo"); secondaryTableResources.next().setCatalog("bar"); - ListIterator<ISecondaryTable> secondaryTsbles = javaEntity().secondaryTables(); + ListIterator<SecondaryTable> secondaryTsbles = javaEntity().secondaryTables(); assertEquals("foo", secondaryTsbles.next().getSpecifiedCatalog()); assertEquals("bar", secondaryTsbles.next().getSpecifiedCatalog()); } @@ -177,12 +177,12 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTables(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - ListIterator<SecondaryTable> secondaryTableResources = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + ListIterator<SecondaryTableAnnotation> secondaryTableResources = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResources.next().setSchema("foo"); secondaryTableResources.next().setSchema("bar"); - ListIterator<ISecondaryTable> secondaryTsbles = javaEntity().secondaryTables(); + ListIterator<SecondaryTable> secondaryTsbles = javaEntity().secondaryTables(); assertEquals("foo", secondaryTsbles.next().getSpecifiedSchema()); assertEquals("bar", secondaryTsbles.next().getSpecifiedSchema()); } @@ -191,8 +191,8 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); table.setCatalog("myCatalog"); @@ -214,12 +214,12 @@ public class JavaSecondaryTableTests extends ContextModelTestCase public void testSetSpecifiedCatalog() throws Exception { createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable table = javaEntity().secondaryTables().next(); + SecondaryTable table = javaEntity().secondaryTables().next(); table.setSpecifiedCatalog("myCatalog"); table.setSpecifiedName(null); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals("myCatalog", tableResource.getCatalog()); @@ -231,8 +231,8 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); tableResource.setSchema("mySchema"); @@ -254,12 +254,12 @@ public class JavaSecondaryTableTests extends ContextModelTestCase public void testSetSpecifiedSchema() throws Exception { createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable table = javaEntity().secondaryTables().next(); + SecondaryTable table = javaEntity().secondaryTables().next(); table.setSpecifiedSchema("mySchema"); table.setSpecifiedName(null); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals("mySchema", tableResource.getSchema()); @@ -271,16 +271,16 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); - ListIterator<IJavaPrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns(); + SecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); + ListIterator<JavaPrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns(); assertFalse(specifiedPkJoinColumns.hasNext()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); //add an annotation to the resource model and verify the context model is updated - PrimaryKeyJoinColumn pkJoinColumn = tableResource.addPkJoinColumn(0); + PrimaryKeyJoinColumnAnnotation pkJoinColumn = tableResource.addPkJoinColumn(0); pkJoinColumn.setName("FOO"); specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns(); assertEquals("FOO", specifiedPkJoinColumns.next().getName()); @@ -315,7 +315,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); assertEquals(0, secondaryTable.specifiedPrimaryKeyJoinColumnsSize()); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO"); @@ -329,7 +329,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); //just the default pkJoinColumn, so 1 assertEquals(1, secondaryTable.primaryKeyJoinColumnsSize()); @@ -345,7 +345,7 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); assertNotNull(secondaryTable.getDefaultPrimaryKeyJoinColumn()); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO"); @@ -359,14 +359,14 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); - IPrimaryKeyJoinColumn defaultPkJoinColumn = secondaryTable.getDefaultPrimaryKeyJoinColumn(); + SecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); + PrimaryKeyJoinColumn defaultPkJoinColumn = secondaryTable.getDefaultPrimaryKeyJoinColumn(); assertNotNull(defaultPkJoinColumn); assertEquals("id", defaultPkJoinColumn.getDefaultName()); assertEquals("id", defaultPkJoinColumn.getDefaultReferencedColumnName()); - IIdMapping idMapping = (IIdMapping) javaEntity().persistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaEntity().persistentType().attributeNamed("id").getMapping(); idMapping.getColumn().setSpecifiedName("FOO"); assertEquals("FOO", defaultPkJoinColumn.getDefaultName()); assertEquals("FOO", defaultPkJoinColumn.getDefaultReferencedColumnName()); @@ -380,19 +380,19 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO"); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR"); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ"); - Iterator<IPrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns(); + Iterator<PrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns(); assertEquals("BAZ", specifiedPkJoinColumns.next().getName()); assertEquals("BAR", specifiedPkJoinColumns.next().getName()); assertEquals("FOO", specifiedPkJoinColumns.next().getName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); - Iterator<PrimaryKeyJoinColumn> pkJoinColumns = tableResource.pkJoinColumns(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); + Iterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns = tableResource.pkJoinColumns(); assertEquals("BAZ", pkJoinColumns.next().getName()); assertEquals("BAR", pkJoinColumns.next().getName()); @@ -404,20 +404,20 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO"); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR"); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ"); - Iterator<IPrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns(); + Iterator<PrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns(); assertEquals("FOO", specifiedPkJoinColumns.next().getName()); assertEquals("BAR", specifiedPkJoinColumns.next().getName()); assertEquals("BAZ", specifiedPkJoinColumns.next().getName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); - Iterator<PrimaryKeyJoinColumn> pkJoinColumns = tableResource.pkJoinColumns(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); + Iterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns = tableResource.pkJoinColumns(); assertEquals("FOO", pkJoinColumns.next().getName()); assertEquals("BAR", pkJoinColumns.next().getName()); @@ -428,25 +428,25 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO"); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR"); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals(3, tableResource.pkJoinColumnsSize()); secondaryTable.removeSpecifiedPrimaryKeyJoinColumn(1); - Iterator<PrimaryKeyJoinColumn> pkJoinColumnResources = tableResource.pkJoinColumns(); + Iterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumnResources = tableResource.pkJoinColumns(); assertEquals("FOO", pkJoinColumnResources.next().getName()); assertEquals("BAZ", pkJoinColumnResources.next().getName()); assertFalse(pkJoinColumnResources.hasNext()); - Iterator<IPrimaryKeyJoinColumn> pkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns(); + Iterator<PrimaryKeyJoinColumn> pkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns(); assertEquals("FOO", pkJoinColumns.next().getName()); assertEquals("BAZ", pkJoinColumns.next().getName()); assertFalse(pkJoinColumns.hasNext()); @@ -475,19 +475,19 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO"); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR"); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ"); - Iterator<IPrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns(); + Iterator<PrimaryKeyJoinColumn> specifiedPkJoinColumns = secondaryTable.specifiedPrimaryKeyJoinColumns(); assertEquals("FOO", specifiedPkJoinColumns.next().getName()); assertEquals("BAR", specifiedPkJoinColumns.next().getName()); assertEquals("BAZ", specifiedPkJoinColumns.next().getName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - SecondaryTable tableResource = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); - Iterator<PrimaryKeyJoinColumn> pkJoinColumns = tableResource.pkJoinColumns(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + SecondaryTableAnnotation tableResource = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); + Iterator<PrimaryKeyJoinColumnAnnotation> pkJoinColumns = tableResource.pkJoinColumns(); assertEquals("FOO", pkJoinColumns.next().getName()); assertEquals("BAR", pkJoinColumns.next().getName()); @@ -506,14 +506,14 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); - IPrimaryKeyJoinColumn defaultPkJoinColumn = secondaryTable.getDefaultPrimaryKeyJoinColumn(); + SecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); + PrimaryKeyJoinColumn defaultPkJoinColumn = secondaryTable.getDefaultPrimaryKeyJoinColumn(); assertEquals("id", defaultPkJoinColumn.getDefaultName()); //remove @Id annotation - IPersistentAttribute idAttribute = javaPersistentType().attributeNamed("id"); - idAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + PersistentAttribute idAttribute = javaPersistentType().attributeNamed("id"); + idAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); assertNull(defaultPkJoinColumn.getDefaultName()); } @@ -521,13 +521,13 @@ public class JavaSecondaryTableTests extends ContextModelTestCase createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); - IPrimaryKeyJoinColumn defaultPkJoinColumn = secondaryTable.getDefaultPrimaryKeyJoinColumn(); + SecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); + PrimaryKeyJoinColumn defaultPkJoinColumn = secondaryTable.getDefaultPrimaryKeyJoinColumn(); assertEquals("id", defaultPkJoinColumn.getDefaultReferencedColumnName()); //remove @Id annotation - IPersistentAttribute idAttribute = javaPersistentType().attributeNamed("id"); - idAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + PersistentAttribute idAttribute = javaPersistentType().attributeNamed("id"); + idAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); assertNull(defaultPkJoinColumn.getDefaultReferencedColumnName()); } @@ -535,12 +535,12 @@ public class JavaSecondaryTableTests extends ContextModelTestCase public void testPrimaryKeyJoinColumnIsVirtual() throws Exception { createTestEntityWithSecondaryTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ISecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); + SecondaryTable secondaryTable = javaEntity().specifiedSecondaryTables().next(); assertTrue(secondaryTable.getDefaultPrimaryKeyJoinColumn().isVirtual()); secondaryTable.addSpecifiedPrimaryKeyJoinColumn(0); - IPrimaryKeyJoinColumn specifiedPkJoinColumn = secondaryTable.specifiedPrimaryKeyJoinColumns().next(); + PrimaryKeyJoinColumn specifiedPkJoinColumn = secondaryTable.specifiedPrimaryKeyJoinColumns().next(); assertFalse(specifiedPkJoinColumn.isVirtual()); assertNull(secondaryTable.getDefaultPrimaryKeyJoinColumn()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java index 0d0fb43b08..f4b0096e29 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaSequenceGeneratorTests.java @@ -12,13 +12,13 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.context.base.IGenerator; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.SequenceGenerator; +import org.eclipse.jpt.core.context.Generator; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.SequenceGenerator; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -68,13 +68,13 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase createTestEntityWithSequenceGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertEquals(SEQUENCE_GENERATOR_NAME, idMapping.getSequenceGenerator().getName()); //change resource model sequenceGenerator name, verify the context model is updated - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); sequenceGenerator.setName("foo"); @@ -85,16 +85,16 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase createTestEntityWithSequenceGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertEquals(SEQUENCE_GENERATOR_NAME, idMapping.getSequenceGenerator().getName()); idMapping.getSequenceGenerator().setName("foo"); assertEquals("foo", idMapping.getSequenceGenerator().getName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertEquals("foo", sequenceGenerator.getName()); } @@ -103,16 +103,16 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase createTestEntityWithSequenceGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertEquals(SEQUENCE_GENERATOR_NAME, idMapping.getSequenceGenerator().getName()); idMapping.getSequenceGenerator().setName(null); assertNull(idMapping.getSequenceGenerator()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertNull(sequenceGenerator); } @@ -121,12 +121,12 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase createTestEntityWithSequenceGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); - assertEquals(ISequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getSequenceGenerator().getInitialValue()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + assertEquals(SequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getSequenceGenerator().getInitialValue()); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); sequenceGenerator.setInitialValue(Integer.valueOf(82)); @@ -138,13 +138,13 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase createTestEntityWithSequenceGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); - assertEquals(ISequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getSequenceGenerator().getDefaultInitialValue()); + assertEquals(SequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getSequenceGenerator().getDefaultInitialValue()); idMapping.getSequenceGenerator().setSpecifiedInitialValue(Integer.valueOf(82)); - assertEquals(ISequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getSequenceGenerator().getDefaultInitialValue()); + assertEquals(SequenceGenerator.DEFAULT_INITIAL_VALUE, idMapping.getSequenceGenerator().getDefaultInitialValue()); assertEquals(Integer.valueOf(82), idMapping.getSequenceGenerator().getSpecifiedInitialValue()); } @@ -152,12 +152,12 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase createTestEntityWithSequenceGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); idMapping.getSequenceGenerator().setSpecifiedInitialValue(Integer.valueOf(20)); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertEquals(Integer.valueOf(20), sequenceGenerator.getInitialValue()); @@ -170,13 +170,13 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase createTestEntityWithSequenceGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); - assertEquals(IGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getSequenceGenerator().getAllocationSize()); + assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getSequenceGenerator().getAllocationSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); sequenceGenerator.setAllocationSize(Integer.valueOf(20)); @@ -188,13 +188,13 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase createTestEntityWithSequenceGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); - assertEquals(IGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getSequenceGenerator().getDefaultAllocationSize()); + assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getSequenceGenerator().getDefaultAllocationSize()); idMapping.getSequenceGenerator().setSpecifiedAllocationSize(Integer.valueOf(20)); - assertEquals(IGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getSequenceGenerator().getDefaultAllocationSize()); + assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getSequenceGenerator().getDefaultAllocationSize()); assertEquals(Integer.valueOf(20), idMapping.getSequenceGenerator().getSpecifiedAllocationSize()); } @@ -202,12 +202,12 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase createTestEntityWithSequenceGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); idMapping.getSequenceGenerator().setSpecifiedAllocationSize(Integer.valueOf(25)); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertEquals(Integer.valueOf(25), sequenceGenerator.getAllocationSize()); @@ -222,12 +222,12 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase createTestEntityWithSequenceGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertNull(idMapping.getSequenceGenerator().getSequenceName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); sequenceGenerator.setSequenceName("mySequenceName"); @@ -239,7 +239,7 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase createTestEntityWithSequenceGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertNull(idMapping.getSequenceGenerator().getDefaultSequenceName()); @@ -253,12 +253,12 @@ public class JavaSequenceGeneratorTests extends ContextModelTestCase createTestEntityWithSequenceGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); idMapping.getSequenceGenerator().setSpecifiedSequenceName("mySequenceName"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertEquals("mySequenceName", sequenceGenerator.getSequenceName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java index 7ccaab6009..5288fba7e8 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableGeneratorTests.java @@ -12,13 +12,13 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.context.base.IGenerator; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.ITableGenerator; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.TableGenerator; +import org.eclipse.jpt.core.context.Generator; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.TableGenerator; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -74,13 +74,13 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertEquals(TABLE_GENERATOR_NAME, idMapping.getTableGenerator().getName()); //change resource model tableGenerator name, verify the context model is updated - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.setName("foo"); @@ -91,16 +91,16 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertEquals(TABLE_GENERATOR_NAME, idMapping.getTableGenerator().getName()); idMapping.getTableGenerator().setName("foo"); assertEquals("foo", idMapping.getTableGenerator().getName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals("foo", tableGenerator.getName()); } @@ -109,16 +109,16 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertEquals(TABLE_GENERATOR_NAME, idMapping.getTableGenerator().getName()); idMapping.getTableGenerator().setName(null); assertNull(idMapping.getTableGenerator()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertNull(tableGenerator); } @@ -127,12 +127,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertNull(idMapping.getTableGenerator().getCatalog()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.setCatalog("myCatalog"); @@ -144,7 +144,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertNull(idMapping.getTableGenerator().getDefaultCatalog()); @@ -158,12 +158,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); idMapping.getTableGenerator().setSpecifiedCatalog("myCatalog"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals("myCatalog", tableGenerator.getCatalog()); @@ -176,12 +176,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertNull(idMapping.getTableGenerator().getSchema()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.setSchema("mySchema"); @@ -193,7 +193,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertNull(idMapping.getTableGenerator().getDefaultSchema()); @@ -207,12 +207,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); idMapping.getTableGenerator().setSpecifiedSchema("mySchema"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals("mySchema", tableGenerator.getSchema()); @@ -225,12 +225,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertNull(idMapping.getTableGenerator().getPkColumnName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.setPkColumnName("myPkColumnName"); @@ -242,7 +242,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertNull(idMapping.getTableGenerator().getDefaultPkColumnName()); @@ -256,12 +256,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); idMapping.getTableGenerator().setSpecifiedPkColumnName("myPkColumnName"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals("myPkColumnName", tableGenerator.getPkColumnName()); @@ -274,12 +274,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertNull(idMapping.getTableGenerator().getValueColumnName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.setValueColumnName("myValueColumnName"); @@ -291,7 +291,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertNull(idMapping.getTableGenerator().getDefaultValueColumnName()); @@ -305,12 +305,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); idMapping.getTableGenerator().setSpecifiedValueColumnName("myValueColumnName"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals("myValueColumnName", tableGenerator.getValueColumnName()); @@ -323,12 +323,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertNull(idMapping.getTableGenerator().getPkColumnValue()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.setPkColumnValue("myPkColumnValue"); @@ -340,7 +340,7 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); assertNull(idMapping.getTableGenerator().getDefaultPkColumnValue()); @@ -354,12 +354,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); idMapping.getTableGenerator().setSpecifiedPkColumnValue("myPkColumnValue"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals("myPkColumnValue", tableGenerator.getPkColumnValue()); @@ -372,12 +372,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); - assertEquals(ITableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getTableGenerator().getInitialValue()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + assertEquals(TableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getTableGenerator().getInitialValue()); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.setInitialValue(Integer.valueOf(82)); @@ -389,13 +389,13 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); - assertEquals(ITableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getTableGenerator().getDefaultInitialValue()); + assertEquals(TableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getTableGenerator().getDefaultInitialValue()); idMapping.getTableGenerator().setSpecifiedInitialValue(Integer.valueOf(82)); - assertEquals(ITableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getTableGenerator().getDefaultInitialValue()); + assertEquals(TableGenerator.DEFAULT_INITIAL_VALUE, idMapping.getTableGenerator().getDefaultInitialValue()); assertEquals(Integer.valueOf(82), idMapping.getTableGenerator().getSpecifiedInitialValue()); } @@ -403,12 +403,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); idMapping.getTableGenerator().setSpecifiedInitialValue(Integer.valueOf(20)); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(Integer.valueOf(20), tableGenerator.getInitialValue()); @@ -421,13 +421,13 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); - assertEquals(IGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getTableGenerator().getAllocationSize()); + assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getTableGenerator().getAllocationSize()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.setAllocationSize(Integer.valueOf(20)); @@ -439,13 +439,13 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); - assertEquals(IGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getTableGenerator().getDefaultAllocationSize()); + assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getTableGenerator().getDefaultAllocationSize()); idMapping.getTableGenerator().setSpecifiedAllocationSize(Integer.valueOf(20)); - assertEquals(IGenerator.DEFAULT_ALLOCATION_SIZE, idMapping.getTableGenerator().getDefaultAllocationSize()); + assertEquals(Generator.DEFAULT_ALLOCATION_SIZE, idMapping.getTableGenerator().getDefaultAllocationSize()); assertEquals(Integer.valueOf(20), idMapping.getTableGenerator().getSpecifiedAllocationSize()); } @@ -453,12 +453,12 @@ public class JavaTableGeneratorTests extends ContextModelTestCase createTestEntityWithTableGenerator(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IIdMapping idMapping = (IIdMapping) javaPersistentType().attributeNamed("id").getMapping(); + IdMapping idMapping = (IdMapping) javaPersistentType().attributeNamed("id").getMapping(); idMapping.getTableGenerator().setSpecifiedAllocationSize(Integer.valueOf(25)); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(Integer.valueOf(25), tableGenerator.getAllocationSize()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java index fe6aa15773..86482b4138 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTableTests.java @@ -13,17 +13,17 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.core.resources.IFile; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.ITable; -import org.eclipse.jpt.core.internal.context.java.IJavaEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.Table; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.Table; +import org.eclipse.jpt.core.context.java.JavaEntity; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.TableAnnotation; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -153,9 +153,9 @@ public class JavaTableTests extends ContextModelTestCase createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - IJavaEntity javaEntity = xmlEntity.javaEntity(); + OrmPersistentType xmlPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) xmlPersistentType.getMapping(); + JavaEntity javaEntity = xmlEntity.javaEntity(); assertNull(javaEntity.getTable().getDefaultSchema()); @@ -168,7 +168,7 @@ public class JavaTableTests extends ContextModelTestCase xmlEntity.getTable().setSpecifiedSchema("XML_SCHEMA"); assertEquals("BAR", javaEntity.getTable().getDefaultSchema()); - entityMappings().removeXmlPersistentType(0); + entityMappings().removeOrmPersistentType(0); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); //default schema taken from persistence-unit-defaults not entity-mappings since the entity is not in an orm.xml file assertEquals("FOO", javaEntity().getTable().getDefaultSchema()); @@ -205,8 +205,8 @@ public class JavaTableTests extends ContextModelTestCase assertEquals("foo", javaEntity().getTable().getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertEquals("foo", table.getName()); } @@ -219,8 +219,8 @@ public class JavaTableTests extends ContextModelTestCase assertNull(javaEntity().getTable().getSpecifiedName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertNull(table); } @@ -229,8 +229,8 @@ public class JavaTableTests extends ContextModelTestCase createTestEntityWithTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); table.setName("foo"); assertEquals("foo", javaEntity().getTable().getSpecifiedName()); @@ -243,8 +243,8 @@ public class JavaTableTests extends ContextModelTestCase createTestEntityWithTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); table.setCatalog("myCatalog"); @@ -270,9 +270,9 @@ public class JavaTableTests extends ContextModelTestCase createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - IJavaEntity javaEntity = xmlEntity.javaEntity(); + OrmPersistentType xmlPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) xmlPersistentType.getMapping(); + JavaEntity javaEntity = xmlEntity.javaEntity(); assertNull(javaEntity.getTable().getDefaultCatalog()); @@ -285,7 +285,7 @@ public class JavaTableTests extends ContextModelTestCase xmlEntity.getTable().setSpecifiedCatalog("XML_CATALOG"); assertEquals("BAR", javaEntity.getTable().getDefaultCatalog()); - entityMappings().removeXmlPersistentType(0); + entityMappings().removeOrmPersistentType(0); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); //default catalog taken from persistence-unite-defaults not entity-mappings since the entity is not in an orm.xml file assertEquals("FOO", javaEntity().getTable().getDefaultCatalog()); @@ -303,11 +303,11 @@ public class JavaTableTests extends ContextModelTestCase public void testSetSpecifiedCatalog() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ITable table = javaEntity().getTable(); + Table table = javaEntity().getTable(); table.setSpecifiedCatalog("myCatalog"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Table tableResource = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + TableAnnotation tableResource = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertEquals("myCatalog", tableResource.getCatalog()); @@ -319,8 +319,8 @@ public class JavaTableTests extends ContextModelTestCase createTestEntityWithTable(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); table.setSchema("mySchema"); @@ -342,11 +342,11 @@ public class JavaTableTests extends ContextModelTestCase public void testSetSpecifiedSchema() throws Exception { createTestEntity(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - ITable table = javaEntity().getTable(); + Table table = javaEntity().getTable(); table.setSpecifiedSchema("mySchema"); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - Table tableResource = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + TableAnnotation tableResource = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertEquals("mySchema", tableResource.getSchema()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java index 9883e34329..62d58fcfea 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaTransientMappingTests.java @@ -12,31 +12,31 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.Embedded; -import org.eclipse.jpt.core.internal.resource.java.EmbeddedId; -import org.eclipse.jpt.core.internal.resource.java.Id; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.ManyToMany; -import org.eclipse.jpt.core.internal.resource.java.ManyToOne; -import org.eclipse.jpt.core.internal.resource.java.OneToMany; -import org.eclipse.jpt.core.internal.resource.java.OneToOne; -import org.eclipse.jpt.core.internal.resource.java.Transient; -import org.eclipse.jpt.core.internal.resource.java.Version; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.EmbeddedId; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.ManyToMany; +import org.eclipse.jpt.core.resource.java.ManyToOne; +import org.eclipse.jpt.core.resource.java.OneToMany; +import org.eclipse.jpt.core.resource.java.OneToOne; +import org.eclipse.jpt.core.resource.java.Transient; +import org.eclipse.jpt.core.resource.java.Version; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -79,16 +79,16 @@ public class JavaTransientMappingTests extends ContextModelTestCase createTestEntityWithTransientMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof BasicMapping); assertFalse(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); } @@ -97,16 +97,16 @@ public class JavaTransientMappingTests extends ContextModelTestCase createTestEntityWithTransientMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IBasicMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof BasicMapping); assertTrue(persistentAttribute.getMapping().isDefault()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); } @@ -114,15 +114,15 @@ public class JavaTransientMappingTests extends ContextModelTestCase createTestEntityWithTransientMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IVersionMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof VersionMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); } @@ -131,15 +131,15 @@ public class JavaTransientMappingTests extends ContextModelTestCase createTestEntityWithTransientMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); } @@ -148,15 +148,15 @@ public class JavaTransientMappingTests extends ContextModelTestCase createTestEntityWithTransientMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof IdMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); } @@ -165,15 +165,15 @@ public class JavaTransientMappingTests extends ContextModelTestCase createTestEntityWithTransientMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); } @@ -182,15 +182,15 @@ public class JavaTransientMappingTests extends ContextModelTestCase createTestEntityWithTransientMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); } @@ -199,15 +199,15 @@ public class JavaTransientMappingTests extends ContextModelTestCase createTestEntityWithTransientMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); } @@ -216,15 +216,15 @@ public class JavaTransientMappingTests extends ContextModelTestCase createTestEntityWithTransientMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); } @@ -233,15 +233,15 @@ public class JavaTransientMappingTests extends ContextModelTestCase createTestEntityWithTransientMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + TransientMapping transientMapping = (TransientMapping) persistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); } @@ -250,8 +250,8 @@ public class JavaTransientMappingTests extends ContextModelTestCase createTestEntityWithTransientMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - ITransientMapping transientMapping = (ITransientMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + TransientMapping transientMapping = (TransientMapping) persistentAttribute.getSpecifiedMapping(); assertNotNull(transientMapping); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java index 535630e6ec..6754d780a4 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JavaVersionMappingTests.java @@ -12,34 +12,34 @@ package org.eclipse.jpt.core.tests.internal.context.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IPersistentAttribute; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.base.TemporalType; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.Column; -import org.eclipse.jpt.core.internal.resource.java.Embedded; -import org.eclipse.jpt.core.internal.resource.java.EmbeddedId; -import org.eclipse.jpt.core.internal.resource.java.Id; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.ManyToMany; -import org.eclipse.jpt.core.internal.resource.java.ManyToOne; -import org.eclipse.jpt.core.internal.resource.java.OneToMany; -import org.eclipse.jpt.core.internal.resource.java.OneToOne; -import org.eclipse.jpt.core.internal.resource.java.Temporal; -import org.eclipse.jpt.core.internal.resource.java.Transient; -import org.eclipse.jpt.core.internal.resource.java.Version; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.PersistentAttribute; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.TemporalType; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.EmbeddedId; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.ManyToMany; +import org.eclipse.jpt.core.resource.java.ManyToOne; +import org.eclipse.jpt.core.resource.java.OneToMany; +import org.eclipse.jpt.core.resource.java.OneToOne; +import org.eclipse.jpt.core.resource.java.Temporal; +import org.eclipse.jpt.core.resource.java.Transient; +import org.eclipse.jpt.core.resource.java.Version; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -108,22 +108,22 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertEquals("FOO", ((IBasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); - assertEquals(TemporalType.TIME, ((IBasicMapping) persistentAttribute.getMapping()).getTemporal()); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((BasicMapping) persistentAttribute.getMapping()).getTemporal()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Basic.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); } @@ -131,21 +131,21 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); - assertEquals("FOO", ((IBasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); - assertEquals(TemporalType.TIME, ((IBasicMapping) persistentAttribute.getMapping()).getTemporal()); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((BasicMapping) persistentAttribute.getMapping()).getTemporal()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); } @@ -153,22 +153,22 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertEquals("FOO", ((IIdMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); - assertEquals(TemporalType.TIME, ((IIdMapping) persistentAttribute.getMapping()).getTemporal()); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertEquals("FOO", ((IdMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((IdMapping) persistentAttribute.getMapping()).getTemporal()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Id.ANNOTATION_NAME)); - assertNotNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNotNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNotNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); } @@ -176,21 +176,21 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Embedded.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); } @@ -198,21 +198,21 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof ITransientMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof TransientMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(Transient.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); } @@ -220,21 +220,21 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(EmbeddedId.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); } @@ -242,21 +242,21 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToOne.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); } @@ -264,21 +264,21 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IOneToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); } @@ -286,21 +286,21 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToOneMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToOne.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); } @@ -308,21 +308,21 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - persistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(persistentAttribute.getMapping() instanceof IManyToManyMapping); + persistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); assertNull(attributeResource.mappingAnnotation(Version.ANNOTATION_NAME)); assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME)); - assertNull(attributeResource.annotation(Column.ANNOTATION_NAME)); + assertNull(attributeResource.annotation(ColumnAnnotation.ANNOTATION_NAME)); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); } @@ -330,8 +330,8 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping(); assertNull(versionMapping.getTemporal()); } @@ -340,8 +340,8 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithTemporal(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping(); assertEquals(TemporalType.TIMESTAMP, versionMapping.getTemporal()); } @@ -350,17 +350,17 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping(); assertNull(versionMapping.getTemporal()); versionMapping.setTemporal(TemporalType.TIME); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Temporal temporal = (Temporal) attributeResource.annotation(Temporal.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.core.internal.resource.java.TemporalType.TIME, temporal.getValue()); + assertEquals(org.eclipse.jpt.core.resource.java.TemporalType.TIME, temporal.getValue()); versionMapping.setTemporal(null); assertNull(attributeResource.annotation(Temporal.ANNOTATION_NAME)); @@ -370,16 +370,16 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping(); assertNull(versionMapping.getTemporal()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); Temporal temporal = (Temporal) attributeResource.addAnnotation(Temporal.ANNOTATION_NAME); - temporal.setValue(org.eclipse.jpt.core.internal.resource.java.TemporalType.DATE); + temporal.setValue(org.eclipse.jpt.core.resource.java.TemporalType.DATE); assertEquals(TemporalType.DATE, versionMapping.getTemporal()); @@ -394,15 +394,15 @@ public class JavaVersionMappingTests extends ContextModelTestCase createTestEntityWithVersionMapping(); addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME); - IPersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); - IVersionMapping versionMapping = (IVersionMapping) persistentAttribute.getSpecifiedMapping(); + PersistentAttribute persistentAttribute = javaPersistentType().attributes().next(); + VersionMapping versionMapping = (VersionMapping) persistentAttribute.getSpecifiedMapping(); assertNull(versionMapping.getColumn().getSpecifiedName()); assertEquals("id", versionMapping.getColumn().getName()); - JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); - JavaPersistentAttributeResource attributeResource = typeResource.attributes().next(); - Column column = (Column) attributeResource.addAnnotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME); + JavaResourcePersistentAttribute attributeResource = typeResource.attributes().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN); column.setName("foo"); assertEquals("foo", versionMapping.getColumn().getSpecifiedName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JptCoreContextJavaModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JptCoreContextJavaModelTests.java index 26e0df5cc6..cc9e39eb63 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JptCoreContextJavaModelTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/java/JptCoreContextJavaModelTests.java @@ -22,8 +22,8 @@ public class JptCoreContextJavaModelTests extends TestCase public static Test suite(boolean all) { TestSuite suite = new TestSuite(JptCoreContextJavaModelTests.class.getName()); - suite.addTestSuite(JavaAssociationOverrideTests.class); - suite.addTestSuite(JavaAttributeOverrideTests.class); + //suite.addTestSuite(JavaAssociationOverrideTests.class); + //suite.addTestSuite(JavaAttributeOverrideTests.class); suite.addTestSuite(JavaBasicMappingTests.class); suite.addTestSuite(JavaColumnTests.class); suite.addTestSuite(JavaDiscriminatorColumnTests.class); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java index 857d7d02a5..f0ca3f207d 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/EntityMappingsTests.java @@ -11,21 +11,21 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.ListIterator; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.AccessType; -import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator; -import org.eclipse.jpt.core.internal.context.base.ITableGenerator; -import org.eclipse.jpt.core.internal.context.orm.XmlNamedNativeQuery; -import org.eclipse.jpt.core.internal.context.orm.XmlNamedQuery; -import org.eclipse.jpt.core.internal.resource.orm.Embeddable; -import org.eclipse.jpt.core.internal.resource.orm.Entity; -import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator; -import org.eclipse.jpt.core.internal.resource.orm.TableGenerator; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.context.AccessType; +import org.eclipse.jpt.core.context.SequenceGenerator; +import org.eclipse.jpt.core.context.TableGenerator; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmNamedNativeQuery; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmNamedQuery; +import org.eclipse.jpt.core.resource.orm.XmlEmbeddable; +import org.eclipse.jpt.core.resource.orm.XmlEntity; +import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator; +import org.eclipse.jpt.core.resource.orm.XmlTableGenerator; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class EntityMappingsTests extends ContextModelTestCase @@ -158,7 +158,7 @@ public class EntityMappingsTests extends ContextModelTestCase assertNull(ormResource().getEntityMappings().getSchema()); ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata()); - org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults persistenceUnitDefaults = OrmFactory.eINSTANCE.createPersistenceUnitDefaults(); + org.eclipse.jpt.core.resource.orm.PersistenceUnitDefaults persistenceUnitDefaults = OrmFactory.eINSTANCE.createPersistenceUnitDefaults(); ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(persistenceUnitDefaults); persistenceUnitDefaults.setSchema("MY_SCHEMA"); assertEquals("MY_SCHEMA", entityMappings().getDefaultSchema()); @@ -226,7 +226,7 @@ public class EntityMappingsTests extends ContextModelTestCase assertNull(ormResource().getEntityMappings().getCatalog()); ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata()); - org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults persistenceUnitDefaults = OrmFactory.eINSTANCE.createPersistenceUnitDefaults(); + org.eclipse.jpt.core.resource.orm.PersistenceUnitDefaults persistenceUnitDefaults = OrmFactory.eINSTANCE.createPersistenceUnitDefaults(); ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(persistenceUnitDefaults); persistenceUnitDefaults.setCatalog("MY_CATALOG"); assertEquals("MY_CATALOG", entityMappings().getDefaultCatalog()); @@ -277,9 +277,9 @@ public class EntityMappingsTests extends ContextModelTestCase assertNull(ormResource().getEntityMappings().getAccess()); //set access in the resource model, verify context model updated - ormResource().getEntityMappings().setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY); + ormResource().getEntityMappings().setAccess(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY); assertEquals(AccessType.PROPERTY, entityMappings().getSpecifiedAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, ormResource().getEntityMappings().getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, ormResource().getEntityMappings().getAccess()); //set access to null in the resource model ormResource().getEntityMappings().setAccess(null); @@ -294,7 +294,7 @@ public class EntityMappingsTests extends ContextModelTestCase //set access in the context model, verify resource model modified entityMappings().setSpecifiedAccess(AccessType.PROPERTY); assertEquals(AccessType.PROPERTY, entityMappings().getSpecifiedAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, ormResource().getEntityMappings().getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, ormResource().getEntityMappings().getAccess()); //set access to null in the context model entityMappings().setSpecifiedAccess(null); @@ -308,14 +308,14 @@ public class EntityMappingsTests extends ContextModelTestCase assertNull(ormResource().getEntityMappings().getAccess()); ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata()); - org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults persistenceUnitDefaults = OrmFactory.eINSTANCE.createPersistenceUnitDefaults(); + org.eclipse.jpt.core.resource.orm.PersistenceUnitDefaults persistenceUnitDefaults = OrmFactory.eINSTANCE.createPersistenceUnitDefaults(); ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(persistenceUnitDefaults); - persistenceUnitDefaults.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY); + persistenceUnitDefaults.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY); assertEquals(AccessType.PROPERTY, entityMappings().getDefaultAccess()); assertNull(entityMappings().getSpecifiedAccess()); assertNull(ormResource().getEntityMappings().getAccess()); - persistenceUnitDefaults.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD); + persistenceUnitDefaults.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD); assertEquals(AccessType.FIELD, entityMappings().getDefaultAccess()); assertNull(entityMappings().getSpecifiedAccess()); assertNull(ormResource().getEntityMappings().getAccess()); @@ -332,11 +332,11 @@ public class EntityMappingsTests extends ContextModelTestCase assertNull(entityMappings().getSpecifiedAccess()); assertNull(ormResource().getEntityMappings().getAccess()); - ormResource().getEntityMappings().setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD); + ormResource().getEntityMappings().setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD); assertNull(entityMappings().getDefaultAccess()); assertEquals(AccessType.FIELD, entityMappings().getAccess()); assertEquals(AccessType.FIELD, entityMappings().getSpecifiedAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, ormResource().getEntityMappings().getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, ormResource().getEntityMappings().getAccess()); ormResource().getEntityMappings().setAccess(null); assertNull(entityMappings().getAccess()); @@ -359,39 +359,39 @@ public class EntityMappingsTests extends ContextModelTestCase public void testUpdateXmlPersistentTypes() throws Exception { - assertFalse(entityMappings().xmlPersistentTypes().hasNext()); + assertFalse(entityMappings().ormPersistentTypes().hasNext()); assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertTrue(ormResource().getEntityMappings().getEntities().isEmpty()); assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty()); //add embeddable in the resource model, verify context model updated - Embeddable embeddable = OrmFactory.eINSTANCE.createEmbeddable(); + XmlEmbeddable embeddable = OrmFactory.eINSTANCE.createEmbeddable(); ormResource().getEntityMappings().getEmbeddables().add(embeddable); embeddable.setClassName("model.Foo"); - assertTrue(entityMappings().xmlPersistentTypes().hasNext()); - assertEquals("model.Foo", entityMappings().xmlPersistentTypes().next().getMapping().getClass_()); + assertTrue(entityMappings().ormPersistentTypes().hasNext()); + assertEquals("model.Foo", entityMappings().ormPersistentTypes().next().getMapping().getClass_()); assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertTrue(ormResource().getEntityMappings().getEntities().isEmpty()); assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty()); assertEquals("model.Foo", ormResource().getEntityMappings().getEmbeddables().get(0).getClassName()); //add entity in the resource model, verify context model updated - Entity entity = OrmFactory.eINSTANCE.createEntity(); + XmlEntity entity = OrmFactory.eINSTANCE.createEntity(); ormResource().getEntityMappings().getEntities().add(entity); entity.setClassName("model.Foo2"); - assertTrue(entityMappings().xmlPersistentTypes().hasNext()); - assertEquals("model.Foo2", entityMappings().xmlPersistentTypes().next().getMapping().getClass_()); + assertTrue(entityMappings().ormPersistentTypes().hasNext()); + assertEquals("model.Foo2", entityMappings().ormPersistentTypes().next().getMapping().getClass_()); assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertFalse(ormResource().getEntityMappings().getEntities().isEmpty()); assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty()); assertEquals("model.Foo2", ormResource().getEntityMappings().getEntities().get(0).getClassName()); //add mapped-superclass in the resource model, verify context model updated - MappedSuperclass mappedSuperclass = OrmFactory.eINSTANCE.createMappedSuperclass(); + XmlMappedSuperclass mappedSuperclass = OrmFactory.eINSTANCE.createMappedSuperclass(); ormResource().getEntityMappings().getMappedSuperclasses().add(mappedSuperclass); mappedSuperclass.setClassName("model.Foo3"); - assertTrue(entityMappings().xmlPersistentTypes().hasNext()); - assertEquals("model.Foo3", entityMappings().xmlPersistentTypes().next().getMapping().getClass_()); + assertTrue(entityMappings().ormPersistentTypes().hasNext()); + assertEquals("model.Foo3", entityMappings().ormPersistentTypes().next().getMapping().getClass_()); assertFalse(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertFalse(ormResource().getEntityMappings().getEntities().isEmpty()); assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty()); @@ -400,36 +400,36 @@ public class EntityMappingsTests extends ContextModelTestCase public void testAddXmlPersistentType() throws Exception { - assertFalse(entityMappings().xmlPersistentTypes().hasNext()); + assertFalse(entityMappings().ormPersistentTypes().hasNext()); assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertTrue(ormResource().getEntityMappings().getEntities().isEmpty()); assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty()); //add embeddable in the context model, verify resource model modified - entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - assertTrue(entityMappings().xmlPersistentTypes().hasNext()); - assertEquals("model.Foo", entityMappings().xmlPersistentTypes().next().getMapping().getClass_()); - assertEquals(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, entityMappings().xmlPersistentTypes().next().getMapping().getKey()); + entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + assertTrue(entityMappings().ormPersistentTypes().hasNext()); + assertEquals("model.Foo", entityMappings().ormPersistentTypes().next().getMapping().getClass_()); + assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, entityMappings().ormPersistentTypes().next().getMapping().getKey()); assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertTrue(ormResource().getEntityMappings().getEntities().isEmpty()); assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty()); assertEquals("model.Foo", ormResource().getEntityMappings().getEmbeddables().get(0).getClassName()); //add entity in the context model, verify resource model modified - entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - assertTrue(entityMappings().xmlPersistentTypes().hasNext()); - assertEquals("model.Foo2", entityMappings().xmlPersistentTypes().next().getMapping().getClass_()); - assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, entityMappings().xmlPersistentTypes().next().getMapping().getKey()); + entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + assertTrue(entityMappings().ormPersistentTypes().hasNext()); + assertEquals("model.Foo2", entityMappings().ormPersistentTypes().next().getMapping().getClass_()); + assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, entityMappings().ormPersistentTypes().next().getMapping().getKey()); assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertFalse(ormResource().getEntityMappings().getEntities().isEmpty()); assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty()); assertEquals("model.Foo2", ormResource().getEntityMappings().getEntities().get(0).getClassName()); //add mapped-superclass in the context model, verify resource model modified - entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo3"); - assertTrue(entityMappings().xmlPersistentTypes().hasNext()); - assertEquals("model.Foo3", entityMappings().xmlPersistentTypes().next().getMapping().getClass_()); - assertEquals(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, entityMappings().xmlPersistentTypes().next().getMapping().getKey()); + entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo3"); + assertTrue(entityMappings().ormPersistentTypes().hasNext()); + assertEquals("model.Foo3", entityMappings().ormPersistentTypes().next().getMapping().getClass_()); + assertEquals(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, entityMappings().ormPersistentTypes().next().getMapping().getKey()); assertFalse(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertFalse(ormResource().getEntityMappings().getEntities().isEmpty()); assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty()); @@ -437,30 +437,30 @@ public class EntityMappingsTests extends ContextModelTestCase } public void testRemoveXmlPersistentType() throws Exception { - assertFalse(entityMappings().xmlPersistentTypes().hasNext()); + assertFalse(entityMappings().ormPersistentTypes().hasNext()); assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertTrue(ormResource().getEntityMappings().getEntities().isEmpty()); assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty()); - entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo3"); + entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo3"); ormResource().save(null); //remove xmlPersistentType from the context model, verify resource model modified - entityMappings().removeXmlPersistentType(1); + entityMappings().removeOrmPersistentType(1); ormResource().save(null); assertFalse(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertTrue(ormResource().getEntityMappings().getEntities().isEmpty()); assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty()); - entityMappings().removeXmlPersistentType(1); + entityMappings().removeOrmPersistentType(1); ormResource().save(null); assertFalse(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertTrue(ormResource().getEntityMappings().getEntities().isEmpty()); assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty()); - entityMappings().removeXmlPersistentType(0); + entityMappings().removeOrmPersistentType(0); ormResource().save(null); assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertTrue(ormResource().getEntityMappings().getEntities().isEmpty()); @@ -471,28 +471,28 @@ public class EntityMappingsTests extends ContextModelTestCase assertEquals(0, entityMappings().tableGeneratorsSize()); assertEquals(0, ormResource().getEntityMappings().getTableGenerators().size()); ormResource().save(null); - TableGenerator tableGeneratorResource = OrmFactory.eINSTANCE.createTableGeneratorImpl(); + XmlTableGenerator tableGeneratorResource = OrmFactory.eINSTANCE.createTableGeneratorImpl(); ormResource().getEntityMappings().getTableGenerators().add(tableGeneratorResource); ormResource().save(null); tableGeneratorResource.setName("FOO"); ormResource().save(null); - ITableGenerator tableGenerator = entityMappings().tableGenerators().next(); + TableGenerator tableGenerator = entityMappings().tableGenerators().next(); assertEquals("FOO", tableGenerator.getName()); - TableGenerator tableGeneratorResource2 = OrmFactory.eINSTANCE.createTableGeneratorImpl(); + XmlTableGenerator tableGeneratorResource2 = OrmFactory.eINSTANCE.createTableGeneratorImpl(); ormResource().getEntityMappings().getTableGenerators().add(0, tableGeneratorResource2); tableGeneratorResource2.setName("BAR"); ormResource().save(null); - ListIterator<ITableGenerator> tableGenerators = entityMappings().tableGenerators(); + ListIterator<TableGenerator> tableGenerators = entityMappings().tableGenerators(); assertEquals("BAR", tableGenerators.next().getName()); assertEquals("FOO", tableGenerators.next().getName()); assertFalse(tableGenerators.hasNext()); - TableGenerator tableGeneratorResource3 = OrmFactory.eINSTANCE.createTableGeneratorImpl(); + XmlTableGenerator tableGeneratorResource3 = OrmFactory.eINSTANCE.createTableGeneratorImpl(); ormResource().getEntityMappings().getTableGenerators().add(1, tableGeneratorResource3); tableGeneratorResource3.setName("BAZ"); ormResource().save(null); @@ -544,7 +544,7 @@ public class EntityMappingsTests extends ContextModelTestCase assertEquals("FOO", ormResource().getEntityMappings().getTableGenerators().get(1).getName()); assertEquals(2, ormResource().getEntityMappings().getTableGenerators().size()); - ListIterator<ITableGenerator> tableGenerators = entityMappings().tableGenerators(); + ListIterator<TableGenerator> tableGenerators = entityMappings().tableGenerators(); assertEquals("BAR", tableGenerators.next().getName()); assertEquals("FOO", tableGenerators.next().getName()); assertFalse(tableGenerators.hasNext()); @@ -554,11 +554,11 @@ public class EntityMappingsTests extends ContextModelTestCase assertEquals(0, entityMappings().tableGeneratorsSize()); assertEquals(0, ormResource().getEntityMappings().getTableGenerators().size()); - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); tableGenerator.setName("FOO"); - ITableGenerator tableGenerator2 = entityMappings().addTableGenerator(1); + TableGenerator tableGenerator2 = entityMappings().addTableGenerator(1); tableGenerator2.setName("BAR"); - ITableGenerator tableGenerator3 = entityMappings().addTableGenerator(2); + TableGenerator tableGenerator3 = entityMappings().addTableGenerator(2); tableGenerator3.setName("BAZ"); assertEquals("FOO", ormResource().getEntityMappings().getTableGenerators().get(0).getName()); assertEquals("BAR", ormResource().getEntityMappings().getTableGenerators().get(1).getName()); @@ -569,8 +569,8 @@ public class EntityMappingsTests extends ContextModelTestCase assertEquals("BAR", ormResource().getEntityMappings().getTableGenerators().get(0).getName()); assertEquals("BAZ", ormResource().getEntityMappings().getTableGenerators().get(1).getName()); - ListIterator<ITableGenerator> tableGenerators = entityMappings().tableGenerators(); - ITableGenerator xmlTableGenerator = tableGenerators.next(); + ListIterator<TableGenerator> tableGenerators = entityMappings().tableGenerators(); + TableGenerator xmlTableGenerator = tableGenerators.next(); assertEquals("BAR", xmlTableGenerator.getName()); assertEquals(tableGenerator2, xmlTableGenerator); xmlTableGenerator = tableGenerators.next(); @@ -598,11 +598,11 @@ public class EntityMappingsTests extends ContextModelTestCase assertEquals(0, entityMappings().tableGeneratorsSize()); assertEquals(0, ormResource().getEntityMappings().getTableGenerators().size()); - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); tableGenerator.setName("FOO"); - ITableGenerator tableGenerator2 = entityMappings().addTableGenerator(1); + TableGenerator tableGenerator2 = entityMappings().addTableGenerator(1); tableGenerator2.setName("BAR"); - ITableGenerator tableGenerator3 = entityMappings().addTableGenerator(2); + TableGenerator tableGenerator3 = entityMappings().addTableGenerator(2); tableGenerator3.setName("BAZ"); assertEquals("FOO", ormResource().getEntityMappings().getTableGenerators().get(0).getName()); assertEquals("BAR", ormResource().getEntityMappings().getTableGenerators().get(1).getName()); @@ -627,11 +627,11 @@ public class EntityMappingsTests extends ContextModelTestCase assertEquals(0, ormResource().getEntityMappings().getTableGenerators().size()); - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); tableGenerator.setName("FOO"); - ITableGenerator tableGenerator2 = entityMappings().addTableGenerator(1); + TableGenerator tableGenerator2 = entityMappings().addTableGenerator(1); tableGenerator2.setName("BAR"); - ITableGenerator tableGenerator3 = entityMappings().addTableGenerator(2); + TableGenerator tableGenerator3 = entityMappings().addTableGenerator(2); tableGenerator3.setName("BAZ"); assertEquals(3, entityMappings().tableGeneratorsSize()); @@ -645,28 +645,28 @@ public class EntityMappingsTests extends ContextModelTestCase assertEquals(0, ormResource().getEntityMappings().getSequenceGenerators().size()); ormResource().save(null); - SequenceGenerator sequenceGeneratorResource = OrmFactory.eINSTANCE.createSequenceGeneratorImpl(); + XmlSequenceGenerator sequenceGeneratorResource = OrmFactory.eINSTANCE.createSequenceGeneratorImpl(); ormResource().getEntityMappings().getSequenceGenerators().add(sequenceGeneratorResource); ormResource().save(null); sequenceGeneratorResource.setName("FOO"); ormResource().save(null); - ISequenceGenerator sequenceGenerator = entityMappings().sequenceGenerators().next(); + SequenceGenerator sequenceGenerator = entityMappings().sequenceGenerators().next(); assertEquals("FOO", sequenceGenerator.getName()); - SequenceGenerator sequenceGeneratorResource2 = OrmFactory.eINSTANCE.createSequenceGeneratorImpl(); + XmlSequenceGenerator sequenceGeneratorResource2 = OrmFactory.eINSTANCE.createSequenceGeneratorImpl(); ormResource().getEntityMappings().getSequenceGenerators().add(0, sequenceGeneratorResource2); sequenceGeneratorResource2.setName("BAR"); ormResource().save(null); - ListIterator<ISequenceGenerator> sequenceGenerators = entityMappings().sequenceGenerators(); + ListIterator<SequenceGenerator> sequenceGenerators = entityMappings().sequenceGenerators(); assertEquals("BAR", sequenceGenerators.next().getName()); assertEquals("FOO", sequenceGenerators.next().getName()); assertFalse(sequenceGenerators.hasNext()); - SequenceGenerator sequenceGeneratorResource3 = OrmFactory.eINSTANCE.createSequenceGeneratorImpl(); + XmlSequenceGenerator sequenceGeneratorResource3 = OrmFactory.eINSTANCE.createSequenceGeneratorImpl(); ormResource().getEntityMappings().getSequenceGenerators().add(1, sequenceGeneratorResource3); sequenceGeneratorResource3.setName("BAZ"); ormResource().save(null); @@ -718,7 +718,7 @@ public class EntityMappingsTests extends ContextModelTestCase assertEquals("FOO", ormResource().getEntityMappings().getSequenceGenerators().get(1).getName()); assertEquals(2, ormResource().getEntityMappings().getSequenceGenerators().size()); - ListIterator<ISequenceGenerator> sequenceGenerators = entityMappings().sequenceGenerators(); + ListIterator<SequenceGenerator> sequenceGenerators = entityMappings().sequenceGenerators(); assertEquals("BAR", sequenceGenerators.next().getName()); assertEquals("FOO", sequenceGenerators.next().getName()); assertFalse(sequenceGenerators.hasNext()); @@ -728,11 +728,11 @@ public class EntityMappingsTests extends ContextModelTestCase assertEquals(0, entityMappings().sequenceGeneratorsSize()); assertEquals(0, ormResource().getEntityMappings().getSequenceGenerators().size()); - ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); + SequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); sequenceGenerator.setName("FOO"); - ISequenceGenerator sequenceGenerator2 = entityMappings().addSequenceGenerator(1); + SequenceGenerator sequenceGenerator2 = entityMappings().addSequenceGenerator(1); sequenceGenerator2.setName("BAR"); - ISequenceGenerator sequenceGenerator3 = entityMappings().addSequenceGenerator(2); + SequenceGenerator sequenceGenerator3 = entityMappings().addSequenceGenerator(2); sequenceGenerator3.setName("BAZ"); assertEquals("FOO", ormResource().getEntityMappings().getSequenceGenerators().get(0).getName()); assertEquals("BAR", ormResource().getEntityMappings().getSequenceGenerators().get(1).getName()); @@ -743,8 +743,8 @@ public class EntityMappingsTests extends ContextModelTestCase assertEquals("BAR", ormResource().getEntityMappings().getSequenceGenerators().get(0).getName()); assertEquals("BAZ", ormResource().getEntityMappings().getSequenceGenerators().get(1).getName()); - ListIterator<ISequenceGenerator> sequenceGenerators = entityMappings().sequenceGenerators(); - ISequenceGenerator xmlSequenceGenerator = sequenceGenerators.next(); + ListIterator<SequenceGenerator> sequenceGenerators = entityMappings().sequenceGenerators(); + SequenceGenerator xmlSequenceGenerator = sequenceGenerators.next(); assertEquals("BAR", xmlSequenceGenerator.getName()); assertEquals(sequenceGenerator2, xmlSequenceGenerator); xmlSequenceGenerator = sequenceGenerators.next(); @@ -772,11 +772,11 @@ public class EntityMappingsTests extends ContextModelTestCase assertEquals(0, entityMappings().sequenceGeneratorsSize()); assertEquals(0, ormResource().getEntityMappings().getSequenceGenerators().size()); - ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); + SequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); sequenceGenerator.setName("FOO"); - ISequenceGenerator sequenceGenerator2 = entityMappings().addSequenceGenerator(1); + SequenceGenerator sequenceGenerator2 = entityMappings().addSequenceGenerator(1); sequenceGenerator2.setName("BAR"); - ISequenceGenerator sequenceGenerator3 = entityMappings().addSequenceGenerator(2); + SequenceGenerator sequenceGenerator3 = entityMappings().addSequenceGenerator(2); sequenceGenerator3.setName("BAZ"); assertEquals("FOO", ormResource().getEntityMappings().getSequenceGenerators().get(0).getName()); assertEquals("BAR", ormResource().getEntityMappings().getSequenceGenerators().get(1).getName()); @@ -802,11 +802,11 @@ public class EntityMappingsTests extends ContextModelTestCase assertEquals(0, ormResource().getEntityMappings().getSequenceGenerators().size()); - ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); + SequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); sequenceGenerator.setName("FOO"); - ISequenceGenerator sequenceGenerator2 = entityMappings().addSequenceGenerator(1); + SequenceGenerator sequenceGenerator2 = entityMappings().addSequenceGenerator(1); sequenceGenerator2.setName("BAR"); - ISequenceGenerator sequenceGenerator3 = entityMappings().addSequenceGenerator(2); + SequenceGenerator sequenceGenerator3 = entityMappings().addSequenceGenerator(2); sequenceGenerator3.setName("BAZ"); assertEquals(3, entityMappings().sequenceGeneratorsSize()); @@ -817,25 +817,25 @@ public class EntityMappingsTests extends ContextModelTestCase public void testAddNamedQuery() throws Exception { - XmlNamedQuery namedQuery = entityMappings().addNamedQuery(0); + GenericOrmNamedQuery namedQuery = entityMappings().addNamedQuery(0); namedQuery.setName("FOO"); assertEquals("FOO", ormResource().getEntityMappings().getNamedQueries().get(0).getName()); - XmlNamedQuery namedQuery2 = entityMappings().addNamedQuery(0); + GenericOrmNamedQuery namedQuery2 = entityMappings().addNamedQuery(0); namedQuery2.setName("BAR"); assertEquals("BAR", ormResource().getEntityMappings().getNamedQueries().get(0).getName()); assertEquals("FOO", ormResource().getEntityMappings().getNamedQueries().get(1).getName()); - XmlNamedQuery namedQuery3 = entityMappings().addNamedQuery(1); + GenericOrmNamedQuery namedQuery3 = entityMappings().addNamedQuery(1); namedQuery3.setName("BAZ"); assertEquals("BAR", ormResource().getEntityMappings().getNamedQueries().get(0).getName()); assertEquals("BAZ", ormResource().getEntityMappings().getNamedQueries().get(1).getName()); assertEquals("FOO", ormResource().getEntityMappings().getNamedQueries().get(2).getName()); - ListIterator<XmlNamedQuery> namedQuerys = entityMappings().namedQueries(); + ListIterator<GenericOrmNamedQuery> namedQuerys = entityMappings().namedQueries(); assertEquals(namedQuery2, namedQuerys.next()); assertEquals(namedQuery3, namedQuerys.next()); assertEquals(namedQuery, namedQuerys.next()); @@ -875,7 +875,7 @@ public class EntityMappingsTests extends ContextModelTestCase entityMappings().moveNamedQuery(2, 0); - ListIterator<XmlNamedQuery> namedQuerys = entityMappings().namedQueries(); + ListIterator<GenericOrmNamedQuery> namedQuerys = entityMappings().namedQueries(); assertEquals("BAR", namedQuerys.next().getName()); assertEquals("BAZ", namedQuerys.next().getName()); assertEquals("FOO", namedQuerys.next().getName()); @@ -905,7 +905,7 @@ public class EntityMappingsTests extends ContextModelTestCase ormResource().getEntityMappings().getNamedQueries().get(1).setName("BAR"); ormResource().getEntityMappings().getNamedQueries().get(2).setName("BAZ"); - ListIterator<XmlNamedQuery> namedQuerys = entityMappings().namedQueries(); + ListIterator<GenericOrmNamedQuery> namedQuerys = entityMappings().namedQueries(); assertEquals("FOO", namedQuerys.next().getName()); assertEquals("BAR", namedQuerys.next().getName()); assertEquals("BAZ", namedQuerys.next().getName()); @@ -941,25 +941,25 @@ public class EntityMappingsTests extends ContextModelTestCase } public void testAddNamedNativeQuery() throws Exception { - XmlNamedNativeQuery namedNativeQuery = entityMappings().addNamedNativeQuery(0); + GenericOrmNamedNativeQuery namedNativeQuery = entityMappings().addNamedNativeQuery(0); namedNativeQuery.setName("FOO"); assertEquals("FOO", ormResource().getEntityMappings().getNamedNativeQueries().get(0).getName()); - XmlNamedNativeQuery namedNativeQuery2 = entityMappings().addNamedNativeQuery(0); + GenericOrmNamedNativeQuery namedNativeQuery2 = entityMappings().addNamedNativeQuery(0); namedNativeQuery2.setName("BAR"); assertEquals("BAR", ormResource().getEntityMappings().getNamedNativeQueries().get(0).getName()); assertEquals("FOO", ormResource().getEntityMappings().getNamedNativeQueries().get(1).getName()); - XmlNamedNativeQuery namedNativeQuery3 = entityMappings().addNamedNativeQuery(1); + GenericOrmNamedNativeQuery namedNativeQuery3 = entityMappings().addNamedNativeQuery(1); namedNativeQuery3.setName("BAZ"); assertEquals("BAR", ormResource().getEntityMappings().getNamedNativeQueries().get(0).getName()); assertEquals("BAZ", ormResource().getEntityMappings().getNamedNativeQueries().get(1).getName()); assertEquals("FOO", ormResource().getEntityMappings().getNamedNativeQueries().get(2).getName()); - ListIterator<XmlNamedNativeQuery> namedNativeQuerys = entityMappings().namedNativeQueries(); + ListIterator<GenericOrmNamedNativeQuery> namedNativeQuerys = entityMappings().namedNativeQueries(); assertEquals(namedNativeQuery2, namedNativeQuerys.next()); assertEquals(namedNativeQuery3, namedNativeQuerys.next()); assertEquals(namedNativeQuery, namedNativeQuerys.next()); @@ -999,7 +999,7 @@ public class EntityMappingsTests extends ContextModelTestCase entityMappings().moveNamedNativeQuery(2, 0); - ListIterator<XmlNamedNativeQuery> namedNativeQuerys = entityMappings().namedNativeQueries(); + ListIterator<GenericOrmNamedNativeQuery> namedNativeQuerys = entityMappings().namedNativeQueries(); assertEquals("BAR", namedNativeQuerys.next().getName()); assertEquals("BAZ", namedNativeQuerys.next().getName()); assertEquals("FOO", namedNativeQuerys.next().getName()); @@ -1029,7 +1029,7 @@ public class EntityMappingsTests extends ContextModelTestCase ormResource().getEntityMappings().getNamedNativeQueries().get(1).setName("BAR"); ormResource().getEntityMappings().getNamedNativeQueries().get(2).setName("BAZ"); - ListIterator<XmlNamedNativeQuery> namedNativeQuerys = entityMappings().namedNativeQueries(); + ListIterator<GenericOrmNamedNativeQuery> namedNativeQuerys = entityMappings().namedNativeQueries(); assertEquals("FOO", namedNativeQuerys.next().getName()); assertEquals("BAR", namedNativeQuerys.next().getName()); assertEquals("BAZ", namedNativeQuerys.next().getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java index 68937faad3..5257bd5ac7 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/OrmXmlTests.java @@ -10,13 +10,13 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.orm; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.OrmXml; -import org.eclipse.jpt.core.internal.context.persistence.IPersistenceXml; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.orm.OrmResource; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.context.orm.OrmXml; +import org.eclipse.jpt.core.context.persistence.PersistenceXml; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.orm.OrmResource; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class OrmXmlTests extends ContextModelTestCase @@ -35,7 +35,7 @@ public class OrmXmlTests extends ContextModelTestCase persistenceResource().save(null); } - protected IPersistenceXml persistenceXml() { + protected PersistenceXml persistenceXml() { return jpaContent().getPersistenceXml(); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java index f699940f3c..3f699c382b 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java @@ -10,13 +10,13 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.orm; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.AccessType; -import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitDefaults; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.context.AccessType; +import org.eclipse.jpt.core.context.orm.PersistenceUnitDefaults; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.orm.PersistenceUnitMetadata; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class PersistenceUnitDefaultsTests extends ContextModelTestCase @@ -48,7 +48,7 @@ public class PersistenceUnitDefaultsTests extends ContextModelTestCase ormResource().getEntityMappings().setPersistenceUnitMetadata(persistenceUnitMetadata); assertTrue(persistenceUnitMetadata.isAllFeaturesUnset()); - org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitDefaults persistenceUnitDefaultsResource = OrmFactory.eINSTANCE.createPersistenceUnitDefaults(); + org.eclipse.jpt.core.resource.orm.PersistenceUnitDefaults persistenceUnitDefaultsResource = OrmFactory.eINSTANCE.createPersistenceUnitDefaults(); persistenceUnitMetadata.setPersistenceUnitDefaults(persistenceUnitDefaultsResource); assertTrue(persistenceUnitDefaultsResource.isAllFeaturesUnset()); @@ -71,10 +71,10 @@ public class PersistenceUnitDefaultsTests extends ContextModelTestCase assertTrue(persistenceUnitDefaultsResource.isAllFeaturesUnset()); - persistenceUnitDefaultsResource.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY); + persistenceUnitDefaultsResource.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY); assertFalse(persistenceUnitDefaultsResource.isAllFeaturesUnset()); - persistenceUnitDefaultsResource.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD); + persistenceUnitDefaultsResource.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD); assertFalse(persistenceUnitDefaultsResource.isAllFeaturesUnset()); persistenceUnitDefaultsResource.setAccess(null); @@ -303,9 +303,9 @@ public class PersistenceUnitDefaultsTests extends ContextModelTestCase //set access in the resource model, verify context model updated ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata()); ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults()); - ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD); + ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD); assertEquals(AccessType.FIELD, persistenceUnitDefaults.getAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess()); //set access to null in the resource model ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(null); @@ -321,7 +321,7 @@ public class PersistenceUnitDefaultsTests extends ContextModelTestCase //set access in the context model, verify resource model modified persistenceUnitDefaults.setAccess(AccessType.PROPERTY); assertEquals(AccessType.PROPERTY, persistenceUnitDefaults.getAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess()); //set access to null in the context model persistenceUnitDefaults.setAccess(null); @@ -337,7 +337,7 @@ public class PersistenceUnitDefaultsTests extends ContextModelTestCase //set access in the context model, verify resource model modified persistenceUnitDefaults.setAccess(AccessType.FIELD); assertEquals(AccessType.FIELD, persistenceUnitDefaults.getAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess()); //set another element on the persistence-unit-defaults element so it doesn't get removed ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCascadePersist(true); @@ -358,7 +358,7 @@ public class PersistenceUnitDefaultsTests extends ContextModelTestCase //set access in the context model, verify resource model modified persistenceUnitDefaults.setAccess(AccessType.FIELD); assertEquals(AccessType.FIELD, persistenceUnitDefaults.getAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().getAccess()); //set access to null in the context model persistenceUnitDefaults.setAccess(null); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java index f42fb493fb..d41b94a138 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java @@ -10,11 +10,11 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.orm; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.PersistenceUnitMetadata; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.context.orm.PersistenceUnitMetadata; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class PersistenceUnitMetadataTests extends ContextModelTestCase @@ -38,7 +38,7 @@ public class PersistenceUnitMetadataTests extends ContextModelTestCase } public void testIsAllFeaturesUnset() throws Exception { - org.eclipse.jpt.core.internal.resource.orm.PersistenceUnitMetadata persistenceUnitMetadata = OrmFactory.eINSTANCE.createPersistenceUnitMetadata(); + org.eclipse.jpt.core.resource.orm.PersistenceUnitMetadata persistenceUnitMetadata = OrmFactory.eINSTANCE.createPersistenceUnitMetadata(); ormResource().getEntityMappings().setPersistenceUnitMetadata(persistenceUnitMetadata); assertTrue(persistenceUnitMetadata.isAllFeaturesUnset()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAssociationOverrideTests.java index 3d93beb16a..d4b9775cf7 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAssociationOverrideTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAssociationOverrideTests.java @@ -11,17 +11,17 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.ListIterator; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.XmlAssociationOverride; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlJoinColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.orm.AssociationOverride; -import org.eclipse.jpt.core.internal.resource.orm.Entity; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmAssociationOverride; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmJoinColumn; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.resource.orm.XmlEntity; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.orm.XmlAssociationOverride; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlAssociationOverrideTests extends ContextModelTestCase @@ -40,12 +40,12 @@ public class XmlAssociationOverrideTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlAssociationOverride xmlAssociationOverride = xmlEntity.addSpecifiedAssociationOverride(0); + OrmPersistentType xmlPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) xmlPersistentType.getMapping(); + GenericOrmAssociationOverride xmlAssociationOverride = xmlEntity.addSpecifiedAssociationOverride(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - AssociationOverride associationOverrideResource = entityResource.getAssociationOverrides().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlAssociationOverride associationOverrideResource = entityResource.getAssociationOverrides().get(0); assertNull(xmlAssociationOverride.getName()); assertNull(associationOverrideResource.getName()); @@ -75,12 +75,12 @@ public class XmlAssociationOverrideTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlAssociationOverride xmlAssociationOverride = xmlEntity.addSpecifiedAssociationOverride(0); + OrmPersistentType xmlPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) xmlPersistentType.getMapping(); + GenericOrmAssociationOverride xmlAssociationOverride = xmlEntity.addSpecifiedAssociationOverride(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - AssociationOverride associationOverrideResource = entityResource.getAssociationOverrides().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlAssociationOverride associationOverrideResource = entityResource.getAssociationOverrides().get(0); assertNull(xmlAssociationOverride.getName()); assertNull(associationOverrideResource.getName()); @@ -98,18 +98,18 @@ public class XmlAssociationOverrideTests extends ContextModelTestCase public void testAddSpecifiedJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0); + OrmPersistentType xmlPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) xmlPersistentType.getMapping(); + GenericOrmAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0); - AssociationOverride associationOverrideResource = ormResource().getEntityMappings().getEntities().get(0).getAssociationOverrides().get(0); + XmlAssociationOverride associationOverrideResource = ormResource().getEntityMappings().getEntities().get(0).getAssociationOverrides().get(0); - XmlJoinColumn joinColumn = associationOverride.addSpecifiedJoinColumn(0); + GenericOrmJoinColumn joinColumn = associationOverride.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("FOO"); assertEquals("FOO", associationOverrideResource.getJoinColumns().get(0).getName()); - XmlJoinColumn joinColumn2 = associationOverride.addSpecifiedJoinColumn(0); + GenericOrmJoinColumn joinColumn2 = associationOverride.addSpecifiedJoinColumn(0); ormResource().save(null); joinColumn2.setSpecifiedName("BAR"); ormResource().save(null); @@ -117,7 +117,7 @@ public class XmlAssociationOverrideTests extends ContextModelTestCase assertEquals("BAR", associationOverrideResource.getJoinColumns().get(0).getName()); assertEquals("FOO", associationOverrideResource.getJoinColumns().get(1).getName()); - XmlJoinColumn joinColumn3 = associationOverride.addSpecifiedJoinColumn(1); + GenericOrmJoinColumn joinColumn3 = associationOverride.addSpecifiedJoinColumn(1); ormResource().save(null); joinColumn3.setSpecifiedName("BAZ"); ormResource().save(null); @@ -126,7 +126,7 @@ public class XmlAssociationOverrideTests extends ContextModelTestCase assertEquals("BAZ", associationOverrideResource.getJoinColumns().get(1).getName()); assertEquals("FOO", associationOverrideResource.getJoinColumns().get(2).getName()); - ListIterator<XmlJoinColumn> joinColumns = associationOverride.specifiedJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = associationOverride.specifiedJoinColumns(); assertEquals(joinColumn2, joinColumns.next()); assertEquals(joinColumn3, joinColumns.next()); assertEquals(joinColumn, joinColumns.next()); @@ -138,11 +138,11 @@ public class XmlAssociationOverrideTests extends ContextModelTestCase } public void testRemoveSpecifiedJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0); + OrmPersistentType xmlPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) xmlPersistentType.getMapping(); + GenericOrmAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0); - AssociationOverride associationOverrideResource = ormResource().getEntityMappings().getEntities().get(0).getAssociationOverrides().get(0); + XmlAssociationOverride associationOverrideResource = ormResource().getEntityMappings().getEntities().get(0).getAssociationOverrides().get(0); associationOverride.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); associationOverride.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); @@ -164,11 +164,11 @@ public class XmlAssociationOverrideTests extends ContextModelTestCase } public void testMoveSpecifiedJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0); + OrmPersistentType xmlPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) xmlPersistentType.getMapping(); + GenericOrmAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0); - AssociationOverride associationOverrideResource = ormResource().getEntityMappings().getEntities().get(0).getAssociationOverrides().get(0); + XmlAssociationOverride associationOverrideResource = ormResource().getEntityMappings().getEntities().get(0).getAssociationOverrides().get(0); associationOverride.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); associationOverride.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); @@ -178,7 +178,7 @@ public class XmlAssociationOverrideTests extends ContextModelTestCase associationOverride.moveSpecifiedJoinColumn(2, 0); - ListIterator<XmlJoinColumn> joinColumns = associationOverride.specifiedJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = associationOverride.specifiedJoinColumns(); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); @@ -200,11 +200,11 @@ public class XmlAssociationOverrideTests extends ContextModelTestCase } public void testUpdateJoinColumns() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0); + OrmPersistentType xmlPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) xmlPersistentType.getMapping(); + GenericOrmAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0); - AssociationOverride associationOverrideResource = ormResource().getEntityMappings().getEntities().get(0).getAssociationOverrides().get(0); + XmlAssociationOverride associationOverrideResource = ormResource().getEntityMappings().getEntities().get(0).getAssociationOverrides().get(0); associationOverrideResource.getJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl()); associationOverrideResource.getJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl()); @@ -214,7 +214,7 @@ public class XmlAssociationOverrideTests extends ContextModelTestCase associationOverrideResource.getJoinColumns().get(1).setName("BAR"); associationOverrideResource.getJoinColumns().get(2).setName("BAZ"); - ListIterator<XmlJoinColumn> joinColumns = associationOverride.specifiedJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = associationOverride.specifiedJoinColumns(); assertEquals("FOO", joinColumns.next().getName()); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAttributeOverrideTests.java index 62386c663c..156ac7d725 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAttributeOverrideTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlAttributeOverrideTests.java @@ -10,15 +10,15 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.orm; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.XmlAttributeOverride; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.orm.AttributeOverride; -import org.eclipse.jpt.core.internal.resource.orm.Entity; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmAttributeOverride; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.resource.orm.XmlEntity; +import org.eclipse.jpt.core.resource.orm.XmlAttributeOverride; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlAttributeOverrideTests extends ContextModelTestCase @@ -37,12 +37,12 @@ public class XmlAttributeOverrideTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlAttributeOverride xmlAttributeOverride = xmlEntity.addSpecifiedAttributeOverride(0); + OrmPersistentType xmlPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) xmlPersistentType.getMapping(); + GenericOrmAttributeOverride xmlAttributeOverride = xmlEntity.addSpecifiedAttributeOverride(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - AttributeOverride attributeOverrideResource = entityResource.getAttributeOverrides().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlAttributeOverride attributeOverrideResource = entityResource.getAttributeOverrides().get(0); assertNull(xmlAttributeOverride.getName()); assertNull(attributeOverrideResource.getName()); @@ -72,12 +72,12 @@ public class XmlAttributeOverrideTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlAttributeOverride xmlAttributeOverride = xmlEntity.addSpecifiedAttributeOverride(0); + OrmPersistentType xmlPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) xmlPersistentType.getMapping(); + GenericOrmAttributeOverride xmlAttributeOverride = xmlEntity.addSpecifiedAttributeOverride(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - AttributeOverride attributeOverrideResource = entityResource.getAttributeOverrides().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlAttributeOverride attributeOverrideResource = entityResource.getAttributeOverrides().get(0); assertNull(xmlAttributeOverride.getName()); assertNull(attributeOverrideResource.getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlBasicMappingTests.java index 8e2d098f39..c223f217f7 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlBasicMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlBasicMappingTests.java @@ -12,29 +12,29 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.EnumType; -import org.eclipse.jpt.core.internal.context.base.FetchType; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.base.TemporalType; -import org.eclipse.jpt.core.internal.context.orm.XmlBasicMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.Basic; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.EnumType; +import org.eclipse.jpt.core.context.FetchType; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.TemporalType; +import org.eclipse.jpt.core.context.orm.OrmColumn; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmBasicMapping; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlBasic; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -120,10 +120,10 @@ public class XmlBasicMappingTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); assertEquals("basicMapping", xmlBasicMapping.getName()); assertEquals("basicMapping", basicResource.getName()); @@ -140,10 +140,10 @@ public class XmlBasicMappingTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); assertEquals("basicMapping", xmlBasicMapping.getName()); assertEquals("basicMapping", basicResource.getName()); @@ -160,22 +160,22 @@ public class XmlBasicMappingTests extends ContextModelTestCase } public void testUpdateSpecifiedFetch() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); assertNull(xmlBasicMapping.getSpecifiedFetch()); assertNull(basicResource.getFetch()); //set fetch in the resource model, verify context model updated - basicResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER); + basicResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.EAGER); assertEquals(FetchType.EAGER, xmlBasicMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, basicResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, basicResource.getFetch()); - basicResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY); + basicResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.LAZY); assertEquals(FetchType.LAZY, xmlBasicMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, basicResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, basicResource.getFetch()); //set fetch to null in the resource model basicResource.setFetch(null); @@ -184,21 +184,21 @@ public class XmlBasicMappingTests extends ContextModelTestCase } public void testModifySpecifiedFetch() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); assertNull(xmlBasicMapping.getSpecifiedFetch()); assertNull(basicResource.getFetch()); //set fetch in the context model, verify resource model updated xmlBasicMapping.setSpecifiedFetch(FetchType.EAGER); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, basicResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, basicResource.getFetch()); assertEquals(FetchType.EAGER, xmlBasicMapping.getSpecifiedFetch()); xmlBasicMapping.setSpecifiedFetch(FetchType.LAZY); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, basicResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, basicResource.getFetch()); assertEquals(FetchType.LAZY, xmlBasicMapping.getSpecifiedFetch()); //set fetch to null in the context model @@ -208,22 +208,22 @@ public class XmlBasicMappingTests extends ContextModelTestCase } public void testUpdateSpecifiedEnumerated() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); assertNull(xmlBasicMapping.getSpecifiedEnumerated()); assertNull(basicResource.getEnumerated()); //set enumerated in the resource model, verify context model updated - basicResource.setEnumerated(org.eclipse.jpt.core.internal.resource.orm.EnumType.ORDINAL); + basicResource.setEnumerated(org.eclipse.jpt.core.resource.orm.EnumType.ORDINAL); assertEquals(EnumType.ORDINAL, xmlBasicMapping.getSpecifiedEnumerated()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.EnumType.ORDINAL, basicResource.getEnumerated()); + assertEquals(org.eclipse.jpt.core.resource.orm.EnumType.ORDINAL, basicResource.getEnumerated()); - basicResource.setEnumerated(org.eclipse.jpt.core.internal.resource.orm.EnumType.STRING); + basicResource.setEnumerated(org.eclipse.jpt.core.resource.orm.EnumType.STRING); assertEquals(EnumType.STRING, xmlBasicMapping.getSpecifiedEnumerated()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.EnumType.STRING, basicResource.getEnumerated()); + assertEquals(org.eclipse.jpt.core.resource.orm.EnumType.STRING, basicResource.getEnumerated()); //set enumerated to null in the resource model basicResource.setEnumerated(null); @@ -232,21 +232,21 @@ public class XmlBasicMappingTests extends ContextModelTestCase } public void testModifySpecifiedEnumerated() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); assertNull(xmlBasicMapping.getSpecifiedEnumerated()); assertNull(basicResource.getEnumerated()); //set enumerated in the context model, verify resource model updated xmlBasicMapping.setSpecifiedEnumerated(EnumType.ORDINAL); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.EnumType.ORDINAL, basicResource.getEnumerated()); + assertEquals(org.eclipse.jpt.core.resource.orm.EnumType.ORDINAL, basicResource.getEnumerated()); assertEquals(EnumType.ORDINAL, xmlBasicMapping.getSpecifiedEnumerated()); xmlBasicMapping.setSpecifiedEnumerated(EnumType.STRING); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.EnumType.STRING, basicResource.getEnumerated()); + assertEquals(org.eclipse.jpt.core.resource.orm.EnumType.STRING, basicResource.getEnumerated()); assertEquals(EnumType.STRING, xmlBasicMapping.getSpecifiedEnumerated()); //set enumerated to null in the context model @@ -256,10 +256,10 @@ public class XmlBasicMappingTests extends ContextModelTestCase } public void testUpdateSpecifiedOptional() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); assertNull(xmlBasicMapping.getSpecifiedOptional()); assertNull(basicResource.getOptional()); @@ -280,10 +280,10 @@ public class XmlBasicMappingTests extends ContextModelTestCase } public void testModifySpecifiedOptional() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); assertNull(xmlBasicMapping.getSpecifiedOptional()); assertNull(basicResource.getOptional()); @@ -304,10 +304,10 @@ public class XmlBasicMappingTests extends ContextModelTestCase } public void testUpdateSpecifiedLob() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); ormResource().save(null); assertFalse(xmlBasicMapping.isLob()); @@ -327,10 +327,10 @@ public class XmlBasicMappingTests extends ContextModelTestCase } public void testModifySpecifiedLob() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); ormResource().save(null); assertFalse(xmlBasicMapping.isLob()); @@ -350,30 +350,30 @@ public class XmlBasicMappingTests extends ContextModelTestCase } public void testUpdateTemporal() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); ormResource().save(null); assertNull(xmlBasicMapping.getTemporal()); assertNull(basicResource.getTemporal()); //set temporal in the resource model, verify context model updated - basicResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE); + basicResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.DATE); ormResource().save(null); assertEquals(TemporalType.DATE, xmlBasicMapping.getTemporal()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE, basicResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, basicResource.getTemporal()); - basicResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME); + basicResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIME); ormResource().save(null); assertEquals(TemporalType.TIME, xmlBasicMapping.getTemporal()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME, basicResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, basicResource.getTemporal()); - basicResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP); + basicResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP); ormResource().save(null); assertEquals(TemporalType.TIMESTAMP, xmlBasicMapping.getTemporal()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP, basicResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, basicResource.getTemporal()); //set temporal to null in the resource model basicResource.setTemporal(null); @@ -383,10 +383,10 @@ public class XmlBasicMappingTests extends ContextModelTestCase } public void testModifyTemporal() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - Basic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + XmlBasic basicResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getBasics().get(0); ormResource().save(null); assertNull(xmlBasicMapping.getTemporal()); @@ -395,17 +395,17 @@ public class XmlBasicMappingTests extends ContextModelTestCase //set temporal in the context model, verify resource model updated xmlBasicMapping.setTemporal(TemporalType.DATE); ormResource().save(null); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE, basicResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, basicResource.getTemporal()); assertEquals(TemporalType.DATE, xmlBasicMapping.getTemporal()); xmlBasicMapping.setTemporal(TemporalType.TIME); ormResource().save(null); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME, basicResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, basicResource.getTemporal()); assertEquals(TemporalType.TIME, xmlBasicMapping.getTemporal()); xmlBasicMapping.setTemporal(TemporalType.TIMESTAMP); ormResource().save(null); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP, basicResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, basicResource.getTemporal()); assertEquals(TemporalType.TIMESTAMP, xmlBasicMapping.getTemporal()); //set temporal to null in the context model @@ -422,12 +422,12 @@ public class XmlBasicMappingTests extends ContextModelTestCase public void testBasicMappingNoUnderylingJavaAttribute() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "foo"); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "foo"); + assertEquals(2, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); assertEquals("foo", xmlBasicMapping.getName()); assertNull(xmlBasicMapping.getSpecifiedEnumerated()); @@ -440,28 +440,28 @@ public class XmlBasicMappingTests extends ContextModelTestCase assertNull(xmlBasicMapping.getTemporal()); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); - assertNull(xmlColumn.getSpecifiedName()); - assertNull(xmlColumn.getSpecifiedUnique()); - assertNull(xmlColumn.getSpecifiedNullable()); - assertNull(xmlColumn.getSpecifiedInsertable()); - assertNull(xmlColumn.getSpecifiedUpdatable()); - assertNull(xmlColumn.getColumnDefinition()); - assertNull(xmlColumn.getSpecifiedTable()); - assertNull(xmlColumn.getSpecifiedLength()); - assertNull(xmlColumn.getSpecifiedPrecision()); - assertNull(xmlColumn.getSpecifiedScale()); - - assertEquals("foo", xmlColumn.getDefaultName()); - assertEquals(Boolean.FALSE, xmlColumn.getDefaultUnique()); - assertEquals(Boolean.TRUE, xmlColumn.getDefaultNullable()); - assertEquals(Boolean.TRUE, xmlColumn.getDefaultInsertable()); - assertEquals(Boolean.TRUE, xmlColumn.getDefaultUpdatable()); - assertEquals(null, xmlColumn.getColumnDefinition()); - assertEquals(TYPE_NAME, xmlColumn.getDefaultTable()); - assertEquals(Integer.valueOf(255), xmlColumn.getDefaultLength()); - assertEquals(Integer.valueOf(0), xmlColumn.getDefaultPrecision()); - assertEquals(Integer.valueOf(0), xmlColumn.getDefaultScale()); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); + assertNull(ormColumn.getSpecifiedName()); + assertNull(ormColumn.getSpecifiedUnique()); + assertNull(ormColumn.getSpecifiedNullable()); + assertNull(ormColumn.getSpecifiedInsertable()); + assertNull(ormColumn.getSpecifiedUpdatable()); + assertNull(ormColumn.getColumnDefinition()); + assertNull(ormColumn.getSpecifiedTable()); + assertNull(ormColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedPrecision()); + assertNull(ormColumn.getSpecifiedScale()); + + assertEquals("foo", ormColumn.getDefaultName()); + assertEquals(Boolean.FALSE, ormColumn.getDefaultUnique()); + assertEquals(Boolean.TRUE, ormColumn.getDefaultNullable()); + assertEquals(Boolean.TRUE, ormColumn.getDefaultInsertable()); + assertEquals(Boolean.TRUE, ormColumn.getDefaultUpdatable()); + assertEquals(null, ormColumn.getColumnDefinition()); + assertEquals(TYPE_NAME, ormColumn.getDefaultTable()); + assertEquals(Integer.valueOf(255), ormColumn.getDefaultLength()); + assertEquals(Integer.valueOf(0), ormColumn.getDefaultPrecision()); + assertEquals(Integer.valueOf(0), ormColumn.getDefaultScale()); } //@Basic(fetch=FetchType.LAZY, optional=false) @@ -473,11 +473,11 @@ public class XmlBasicMappingTests extends ContextModelTestCase //@Enumerated(EnumType.STRING) public void testVirtualMappingMetadataCompleteFalse() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + assertEquals(2, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); assertEquals("id", xmlBasicMapping.getName()); assertTrue(xmlBasicMapping.isLob()); assertEquals(EnumType.STRING, xmlBasicMapping.getSpecifiedEnumerated()); @@ -485,27 +485,27 @@ public class XmlBasicMappingTests extends ContextModelTestCase assertEquals(Boolean.FALSE, xmlBasicMapping.getSpecifiedOptional()); assertEquals(TemporalType.TIMESTAMP, xmlBasicMapping.getTemporal()); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); - assertEquals("MY_COLUMN", xmlColumn.getSpecifiedName()); - assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique()); - assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable()); - assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable()); - assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable()); - assertEquals("COLUMN_DEFINITION", xmlColumn.getColumnDefinition()); - assertEquals("MY_TABLE", xmlColumn.getSpecifiedTable()); - assertEquals(Integer.valueOf(5), xmlColumn.getSpecifiedLength()); - assertEquals(Integer.valueOf(6), xmlColumn.getSpecifiedPrecision()); - assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale()); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); + assertEquals("MY_COLUMN", ormColumn.getSpecifiedName()); + assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUnique()); + assertEquals(Boolean.FALSE, ormColumn.getSpecifiedNullable()); + assertEquals(Boolean.FALSE, ormColumn.getSpecifiedInsertable()); + assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUpdatable()); + assertEquals("COLUMN_DEFINITION", ormColumn.getColumnDefinition()); + assertEquals("MY_TABLE", ormColumn.getSpecifiedTable()); + assertEquals(Integer.valueOf(5), ormColumn.getSpecifiedLength()); + assertEquals(Integer.valueOf(6), ormColumn.getSpecifiedPrecision()); + assertEquals(Integer.valueOf(7), ormColumn.getSpecifiedScale()); } public void testVirtualMappingMetadataCompleteTrue() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - xmlPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); + assertEquals(2, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); assertEquals("id", xmlBasicMapping.getName()); assertFalse(xmlBasicMapping.isLob()); assertEquals(EnumType.ORDINAL, xmlBasicMapping.getSpecifiedEnumerated()); @@ -513,28 +513,28 @@ public class XmlBasicMappingTests extends ContextModelTestCase assertEquals(Boolean.TRUE, xmlBasicMapping.getSpecifiedOptional()); assertNull(xmlBasicMapping.getTemporal()); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); - assertEquals("id", xmlColumn.getSpecifiedName()); - assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUnique()); - assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedNullable()); - assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedInsertable()); - assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUpdatable()); - assertNull(xmlColumn.getColumnDefinition()); - assertEquals(TYPE_NAME, xmlColumn.getSpecifiedTable()); - assertEquals(Integer.valueOf(255), xmlColumn.getSpecifiedLength()); - assertEquals(Integer.valueOf(0), xmlColumn.getSpecifiedPrecision()); - assertEquals(Integer.valueOf(0), xmlColumn.getSpecifiedScale()); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); + assertEquals("id", ormColumn.getSpecifiedName()); + assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUnique()); + assertEquals(Boolean.TRUE, ormColumn.getSpecifiedNullable()); + assertEquals(Boolean.TRUE, ormColumn.getSpecifiedInsertable()); + assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUpdatable()); + assertNull(ormColumn.getColumnDefinition()); + assertEquals(TYPE_NAME, ormColumn.getSpecifiedTable()); + assertEquals(Integer.valueOf(255), ormColumn.getSpecifiedLength()); + assertEquals(Integer.valueOf(0), ormColumn.getSpecifiedPrecision()); + assertEquals(Integer.valueOf(0), ormColumn.getSpecifiedScale()); } public void testSpecifiedMapping() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id"); - assertEquals(1, xmlPersistentType.virtualAttributesSize()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "id"); + assertEquals(1, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); assertEquals("id", xmlBasicMapping.getName()); assertNull(xmlBasicMapping.getSpecifiedEnumerated()); @@ -546,28 +546,28 @@ public class XmlBasicMappingTests extends ContextModelTestCase assertEquals(Boolean.TRUE, xmlBasicMapping.getDefaultOptional()); assertNull(xmlBasicMapping.getTemporal()); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); - assertNull(xmlColumn.getSpecifiedName()); - assertNull(xmlColumn.getSpecifiedUnique()); - assertNull(xmlColumn.getSpecifiedNullable()); - assertNull(xmlColumn.getSpecifiedInsertable()); - assertNull(xmlColumn.getSpecifiedUpdatable()); - assertNull(xmlColumn.getColumnDefinition()); - assertNull(xmlColumn.getSpecifiedTable()); - assertNull(xmlColumn.getSpecifiedLength()); - assertNull(xmlColumn.getSpecifiedPrecision()); - assertNull(xmlColumn.getSpecifiedScale()); - - assertEquals("id", xmlColumn.getDefaultName()); - assertEquals(Boolean.FALSE, xmlColumn.getDefaultUnique()); - assertEquals(Boolean.TRUE, xmlColumn.getDefaultNullable()); - assertEquals(Boolean.TRUE, xmlColumn.getDefaultInsertable()); - assertEquals(Boolean.TRUE, xmlColumn.getDefaultUpdatable()); - assertEquals(null, xmlColumn.getColumnDefinition()); - assertEquals(TYPE_NAME, xmlColumn.getDefaultTable()); - assertEquals(Integer.valueOf(255), xmlColumn.getDefaultLength()); - assertEquals(Integer.valueOf(0), xmlColumn.getDefaultPrecision()); - assertEquals(Integer.valueOf(0), xmlColumn.getDefaultScale()); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); + assertNull(ormColumn.getSpecifiedName()); + assertNull(ormColumn.getSpecifiedUnique()); + assertNull(ormColumn.getSpecifiedNullable()); + assertNull(ormColumn.getSpecifiedInsertable()); + assertNull(ormColumn.getSpecifiedUpdatable()); + assertNull(ormColumn.getColumnDefinition()); + assertNull(ormColumn.getSpecifiedTable()); + assertNull(ormColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedPrecision()); + assertNull(ormColumn.getSpecifiedScale()); + + assertEquals("id", ormColumn.getDefaultName()); + assertEquals(Boolean.FALSE, ormColumn.getDefaultUnique()); + assertEquals(Boolean.TRUE, ormColumn.getDefaultNullable()); + assertEquals(Boolean.TRUE, ormColumn.getDefaultInsertable()); + assertEquals(Boolean.TRUE, ormColumn.getDefaultUpdatable()); + assertEquals(null, ormColumn.getColumnDefinition()); + assertEquals(TYPE_NAME, ormColumn.getDefaultTable()); + assertEquals(Integer.valueOf(255), ormColumn.getDefaultLength()); + assertEquals(Integer.valueOf(0), ormColumn.getDefaultPrecision()); + assertEquals(Integer.valueOf(0), ormColumn.getDefaultScale()); } //3 things tested above @@ -578,10 +578,10 @@ public class XmlBasicMappingTests extends ContextModelTestCase public void testBasicMorphToIdMapping() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); - IBasicMapping basicMapping = (IBasicMapping) xmlPersistentAttribute.getMapping(); + BasicMapping basicMapping = (BasicMapping) xmlPersistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setLob(true); @@ -591,21 +591,21 @@ public class XmlBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof IdMapping); assertEquals("basic", xmlPersistentAttribute.getMapping().getName()); - assertEquals(TemporalType.TIME, ((IIdMapping) xmlPersistentAttribute.getMapping()).getTemporal()); - assertEquals("FOO", ((IIdMapping) xmlPersistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((IdMapping) xmlPersistentAttribute.getMapping()).getTemporal()); + assertEquals("FOO", ((IdMapping) xmlPersistentAttribute.getMapping()).getColumn().getSpecifiedName()); } public void testBasicMorphToVersionMapping() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); - IBasicMapping basicMapping = (IBasicMapping) xmlPersistentAttribute.getMapping(); + BasicMapping basicMapping = (BasicMapping) xmlPersistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setLob(true); @@ -615,21 +615,21 @@ public class XmlBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IVersionMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof VersionMapping); assertEquals("basic", xmlPersistentAttribute.getMapping().getName()); - assertEquals(TemporalType.TIME, ((IVersionMapping) xmlPersistentAttribute.getMapping()).getTemporal()); - assertEquals("FOO", ((IVersionMapping) xmlPersistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((VersionMapping) xmlPersistentAttribute.getMapping()).getTemporal()); + assertEquals("FOO", ((VersionMapping) xmlPersistentAttribute.getMapping()).getColumn().getSpecifiedName()); } public void testBasicMorphToTransientMapping() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); - IBasicMapping basicMapping = (IBasicMapping) xmlPersistentAttribute.getMapping(); + BasicMapping basicMapping = (BasicMapping) xmlPersistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setLob(true); @@ -639,19 +639,19 @@ public class XmlBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof ITransientMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof TransientMapping); assertEquals("basic", xmlPersistentAttribute.getMapping().getName()); } public void testBasicMorphToEmbeddedMapping() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); - IBasicMapping basicMapping = (IBasicMapping) xmlPersistentAttribute.getMapping(); + BasicMapping basicMapping = (BasicMapping) xmlPersistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setLob(true); @@ -661,19 +661,19 @@ public class XmlBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedMapping); assertEquals("basic", xmlPersistentAttribute.getMapping().getName()); } public void testBasicMorphToEmbeddedIdMapping() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); - IBasicMapping basicMapping = (IBasicMapping) xmlPersistentAttribute.getMapping(); + BasicMapping basicMapping = (BasicMapping) xmlPersistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setLob(true); @@ -683,19 +683,19 @@ public class XmlBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedIdMapping); assertEquals("basic", xmlPersistentAttribute.getMapping().getName()); } public void testBasicMorphToOneToOneMapping() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); - IBasicMapping basicMapping = (IBasicMapping) xmlPersistentAttribute.getMapping(); + BasicMapping basicMapping = (BasicMapping) xmlPersistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setLob(true); @@ -705,19 +705,19 @@ public class XmlBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToOneMapping); assertEquals("basic", xmlPersistentAttribute.getMapping().getName()); } public void testBasicMorphToOneToManyMapping() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); - IBasicMapping basicMapping = (IBasicMapping) xmlPersistentAttribute.getMapping(); + BasicMapping basicMapping = (BasicMapping) xmlPersistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setLob(true); @@ -727,19 +727,19 @@ public class XmlBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToManyMapping); assertEquals("basic", xmlPersistentAttribute.getMapping().getName()); } public void testBasicMorphToManyToOneMapping() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); - IBasicMapping basicMapping = (IBasicMapping) xmlPersistentAttribute.getMapping(); + BasicMapping basicMapping = (BasicMapping) xmlPersistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setLob(true); @@ -749,19 +749,19 @@ public class XmlBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToOneMapping); assertEquals("basic", xmlPersistentAttribute.getMapping().getName()); } public void testBasicMorphToManyToManyMapping() throws Exception { createTestEntityBasicMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basic"); - IBasicMapping basicMapping = (IBasicMapping) xmlPersistentAttribute.getMapping(); + BasicMapping basicMapping = (BasicMapping) xmlPersistentAttribute.getMapping(); assertFalse(basicMapping.isDefault()); basicMapping.getColumn().setSpecifiedName("FOO"); basicMapping.setLob(true); @@ -771,10 +771,10 @@ public class XmlBasicMappingTests extends ContextModelTestCase basicMapping.setSpecifiedOptional(Boolean.FALSE); assertFalse(basicMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToManyMapping); assertEquals("basic", xmlPersistentAttribute.getMapping().getName()); } }
\ No newline at end of file diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlCascadeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlCascadeTests.java index 6bceca8fa9..dc8afcb284 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlCascadeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlCascadeTests.java @@ -10,16 +10,16 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.orm; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.XmlCascade; -import org.eclipse.jpt.core.internal.context.orm.XmlOneToOneMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.orm.OneToOne; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmOneToOneMapping; +import org.eclipse.jpt.core.internal.context.orm.OrmCascade; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.orm.XmlOneToOne; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlCascadeTests extends ContextModelTestCase @@ -39,11 +39,11 @@ public class XmlCascadeTests extends ContextModelTestCase } public void testUpdateCascadeAll() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertEquals(false, xmlCascade.isAll()); assertNull(oneToOne.getCascade()); @@ -65,12 +65,12 @@ public class XmlCascadeTests extends ContextModelTestCase } public void testModifyCascadeAll() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertEquals(false, xmlCascade.isAll()); assertNull(oneToOne.getCascade()); @@ -87,11 +87,11 @@ public class XmlCascadeTests extends ContextModelTestCase } public void testUpdateCascadePersist() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertEquals(false, xmlCascade.isPersist()); assertNull(oneToOne.getCascade()); @@ -113,12 +113,12 @@ public class XmlCascadeTests extends ContextModelTestCase } public void testModifyCascadePersist() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertEquals(false, xmlCascade.isPersist()); assertNull(oneToOne.getCascade()); @@ -135,11 +135,11 @@ public class XmlCascadeTests extends ContextModelTestCase } public void testUpdateCascadeMerge() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertEquals(false, xmlCascade.isMerge()); assertNull(oneToOne.getCascade()); @@ -161,12 +161,12 @@ public class XmlCascadeTests extends ContextModelTestCase } public void testModifyCascadeMerge() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertEquals(false, xmlCascade.isMerge()); assertNull(oneToOne.getCascade()); @@ -183,11 +183,11 @@ public class XmlCascadeTests extends ContextModelTestCase } public void testUpdateCascadeRemove() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertEquals(false, xmlCascade.isRemove()); assertNull(oneToOne.getCascade()); @@ -209,12 +209,12 @@ public class XmlCascadeTests extends ContextModelTestCase } public void testModifyCascadeRemove() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertEquals(false, xmlCascade.isRemove()); assertNull(oneToOne.getCascade()); @@ -231,11 +231,11 @@ public class XmlCascadeTests extends ContextModelTestCase } public void testUpdateCascadeRefresh() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertEquals(false, xmlCascade.isRefresh()); assertNull(oneToOne.getCascade()); @@ -257,12 +257,12 @@ public class XmlCascadeTests extends ContextModelTestCase } public void testModifyCascadeRefresh() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertEquals(false, xmlCascade.isRefresh()); assertNull(oneToOne.getCascade()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlColumnTests.java index 582f503fb9..2d4437d611 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlColumnTests.java @@ -12,18 +12,18 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.XmlBasicMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.Basic; -import org.eclipse.jpt.core.internal.resource.orm.Entity; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.orm.OrmColumn; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmBasicMapping; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlBasic; +import org.eclipse.jpt.core.resource.orm.XmlEntity; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -90,121 +90,121 @@ public class XmlColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedName()); + assertNull(ormColumn.getSpecifiedName()); assertNull(basic.getColumn()); //set name in the resource model, verify context model updated basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl()); basic.getColumn().setName("FOO"); ormResource().save(null); - assertEquals("FOO", xmlColumn.getSpecifiedName()); + assertEquals("FOO", ormColumn.getSpecifiedName()); assertEquals("FOO", basic.getColumn().getName()); //set name to null in the resource model basic.getColumn().setName(null); - assertNull(xmlColumn.getSpecifiedName()); + assertNull(ormColumn.getSpecifiedName()); assertNull(basic.getColumn().getName()); basic.getColumn().setName("FOO"); - assertEquals("FOO", xmlColumn.getSpecifiedName()); + assertEquals("FOO", ormColumn.getSpecifiedName()); assertEquals("FOO", basic.getColumn().getName()); basic.setColumn(null); - assertNull(xmlColumn.getSpecifiedName()); + assertNull(ormColumn.getSpecifiedName()); assertNull(basic.getColumn()); } public void testModifySpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedName()); + assertNull(ormColumn.getSpecifiedName()); assertNull(basic.getColumn()); //set name in the context model, verify resource model modified - xmlColumn.setSpecifiedName("foo"); - assertEquals("foo", xmlColumn.getSpecifiedName()); + ormColumn.setSpecifiedName("foo"); + assertEquals("foo", ormColumn.getSpecifiedName()); assertEquals("foo", basic.getColumn().getName()); //set name to null in the context model - xmlColumn.setSpecifiedName(null); - assertNull(xmlColumn.getSpecifiedName()); + ormColumn.setSpecifiedName(null); + assertNull(ormColumn.getSpecifiedName()); assertNull(basic.getColumn()); } public void testUpdateColumnDefinition() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getColumnDefinition()); + assertNull(ormColumn.getColumnDefinition()); assertNull(basic.getColumn()); //set name in the resource model, verify context model updated basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl()); basic.getColumn().setColumnDefinition("FOO"); ormResource().save(null); - assertEquals("FOO", xmlColumn.getColumnDefinition()); + assertEquals("FOO", ormColumn.getColumnDefinition()); assertEquals("FOO", basic.getColumn().getColumnDefinition()); //set name to null in the resource model basic.getColumn().setColumnDefinition(null); - assertNull(xmlColumn.getColumnDefinition()); + assertNull(ormColumn.getColumnDefinition()); assertNull(basic.getColumn().getColumnDefinition()); basic.getColumn().setColumnDefinition("FOO"); - assertEquals("FOO", xmlColumn.getColumnDefinition()); + assertEquals("FOO", ormColumn.getColumnDefinition()); assertEquals("FOO", basic.getColumn().getColumnDefinition()); basic.setColumn(null); - assertNull(xmlColumn.getColumnDefinition()); + assertNull(ormColumn.getColumnDefinition()); assertNull(basic.getColumn()); } public void testModifyColumnDefinition() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getColumnDefinition()); + assertNull(ormColumn.getColumnDefinition()); assertNull(basic.getColumn()); //set name in the context model, verify resource model modified - xmlColumn.setColumnDefinition("foo"); - assertEquals("foo", xmlColumn.getColumnDefinition()); + ormColumn.setColumnDefinition("foo"); + assertEquals("foo", ormColumn.getColumnDefinition()); assertEquals("foo", basic.getColumn().getColumnDefinition()); //set name to null in the context model - xmlColumn.setColumnDefinition(null); - assertNull(xmlColumn.getColumnDefinition()); + ormColumn.setColumnDefinition(null); + assertNull(ormColumn.getColumnDefinition()); assertNull(basic.getColumn()); } // public void testUpdateDefaultNameFromJavaTable() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName()); // // xmlEntity.javaEntity().getTable().setSpecifiedName("Foo"); @@ -230,8 +230,8 @@ public class XmlColumnTests extends ContextModelTestCase // public void testUpdateDefaultNameNoJava() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertEquals("Foo", xmlEntity.getTable().getDefaultName()); // } // @@ -239,10 +239,10 @@ public class XmlColumnTests extends ContextModelTestCase // createTestEntity(); // createTestSubType(); // -// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); -// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping(); -// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping(); +// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); +// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping(); +// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping(); // // assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName()); // assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName()); @@ -257,442 +257,442 @@ public class XmlColumnTests extends ContextModelTestCase // } public void testUpdateSpecifiedTable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedTable()); + assertNull(ormColumn.getSpecifiedTable()); assertNull(basic.getColumn()); //set name in the resource model, verify context model updated basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl()); basic.getColumn().setTable("FOO"); - assertEquals("FOO", xmlColumn.getSpecifiedTable()); + assertEquals("FOO", ormColumn.getSpecifiedTable()); assertEquals("FOO", basic.getColumn().getTable()); //set name to null in the resource model basic.getColumn().setTable(null); - assertNull(xmlColumn.getSpecifiedTable()); + assertNull(ormColumn.getSpecifiedTable()); assertNull(basic.getColumn().getTable()); basic.getColumn().setTable("FOO"); - assertEquals("FOO", xmlColumn.getSpecifiedTable()); + assertEquals("FOO", ormColumn.getSpecifiedTable()); assertEquals("FOO", basic.getColumn().getTable()); basic.setColumn(null); - assertNull(xmlColumn.getSpecifiedTable()); + assertNull(ormColumn.getSpecifiedTable()); assertNull(basic.getColumn()); } public void testModifySpecifiedTable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedTable()); + assertNull(ormColumn.getSpecifiedTable()); assertNull(basic.getColumn()); //set name in the context model, verify resource model modified - xmlColumn.setSpecifiedTable("foo"); - assertEquals("foo", xmlColumn.getSpecifiedTable()); + ormColumn.setSpecifiedTable("foo"); + assertEquals("foo", ormColumn.getSpecifiedTable()); assertEquals("foo", basic.getColumn().getTable()); //set name to null in the context model - xmlColumn.setSpecifiedTable(null); - assertNull(xmlColumn.getSpecifiedTable()); + ormColumn.setSpecifiedTable(null); + assertNull(ormColumn.getSpecifiedTable()); assertNull(basic.getColumn()); } public void testUpdateSpecifiedNullable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedNullable()); + assertNull(ormColumn.getSpecifiedNullable()); assertNull(basic.getColumn()); //set name in the resource model, verify context model updated basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl()); basic.getColumn().setNullable(Boolean.TRUE); - assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedNullable()); + assertEquals(Boolean.TRUE, ormColumn.getSpecifiedNullable()); assertEquals(Boolean.TRUE, basic.getColumn().getNullable()); //set name to null in the resource model basic.getColumn().setNullable(null); - assertNull(xmlColumn.getSpecifiedNullable()); + assertNull(ormColumn.getSpecifiedNullable()); assertNull(basic.getColumn().getNullable()); basic.getColumn().setNullable(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable()); + assertEquals(Boolean.FALSE, ormColumn.getSpecifiedNullable()); assertEquals(Boolean.FALSE, basic.getColumn().getNullable()); basic.setColumn(null); - assertNull(xmlColumn.getSpecifiedNullable()); + assertNull(ormColumn.getSpecifiedNullable()); assertNull(basic.getColumn()); } public void testModifySpecifiedNullable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedNullable()); + assertNull(ormColumn.getSpecifiedNullable()); assertNull(basic.getColumn()); //set name in the context model, verify resource model modified - xmlColumn.setSpecifiedNullable(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable()); + ormColumn.setSpecifiedNullable(Boolean.FALSE); + assertEquals(Boolean.FALSE, ormColumn.getSpecifiedNullable()); assertEquals(Boolean.FALSE, basic.getColumn().getNullable()); //set name to null in the context model - xmlColumn.setSpecifiedNullable(null); - assertNull(xmlColumn.getSpecifiedNullable()); + ormColumn.setSpecifiedNullable(null); + assertNull(ormColumn.getSpecifiedNullable()); assertNull(basic.getColumn()); } public void testUpdateSpecifiedUpdatable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedUpdatable()); + assertNull(ormColumn.getSpecifiedUpdatable()); assertNull(basic.getColumn()); //set name in the resource model, verify context model updated basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl()); basic.getColumn().setUpdatable(Boolean.TRUE); - assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUpdatable()); + assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUpdatable()); assertEquals(Boolean.TRUE, basic.getColumn().getUpdatable()); //set name to null in the resource model basic.getColumn().setUpdatable(null); - assertNull(xmlColumn.getSpecifiedUpdatable()); + assertNull(ormColumn.getSpecifiedUpdatable()); assertNull(basic.getColumn().getUpdatable()); basic.getColumn().setUpdatable(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable()); + assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUpdatable()); assertEquals(Boolean.FALSE, basic.getColumn().getUpdatable()); basic.setColumn(null); - assertNull(xmlColumn.getSpecifiedUpdatable()); + assertNull(ormColumn.getSpecifiedUpdatable()); assertNull(basic.getColumn()); } public void testModifySpecifiedUpdatable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedUpdatable()); + assertNull(ormColumn.getSpecifiedUpdatable()); assertNull(basic.getColumn()); //set name in the context model, verify resource model modified - xmlColumn.setSpecifiedUpdatable(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUpdatable()); + ormColumn.setSpecifiedUpdatable(Boolean.FALSE); + assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUpdatable()); assertEquals(Boolean.FALSE, basic.getColumn().getUpdatable()); //set name to null in the context model - xmlColumn.setSpecifiedUpdatable(null); - assertNull(xmlColumn.getSpecifiedUpdatable()); + ormColumn.setSpecifiedUpdatable(null); + assertNull(ormColumn.getSpecifiedUpdatable()); assertNull(basic.getColumn()); } public void testUpdateSpecifiedInsertable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedInsertable()); + assertNull(ormColumn.getSpecifiedInsertable()); assertNull(basic.getColumn()); //set name in the resource model, verify context model updated basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl()); basic.getColumn().setInsertable(Boolean.TRUE); - assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedInsertable()); + assertEquals(Boolean.TRUE, ormColumn.getSpecifiedInsertable()); assertEquals(Boolean.TRUE, basic.getColumn().getInsertable()); //set name to null in the resource model basic.getColumn().setInsertable(null); - assertNull(xmlColumn.getSpecifiedInsertable()); + assertNull(ormColumn.getSpecifiedInsertable()); assertNull(basic.getColumn().getInsertable()); basic.getColumn().setInsertable(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable()); + assertEquals(Boolean.FALSE, ormColumn.getSpecifiedInsertable()); assertEquals(Boolean.FALSE, basic.getColumn().getInsertable()); basic.setColumn(null); - assertNull(xmlColumn.getSpecifiedInsertable()); + assertNull(ormColumn.getSpecifiedInsertable()); assertNull(basic.getColumn()); } public void testModifySpecifiedInsertable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedInsertable()); + assertNull(ormColumn.getSpecifiedInsertable()); assertNull(basic.getColumn()); //set name in the context model, verify resource model modified - xmlColumn.setSpecifiedInsertable(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedInsertable()); + ormColumn.setSpecifiedInsertable(Boolean.FALSE); + assertEquals(Boolean.FALSE, ormColumn.getSpecifiedInsertable()); assertEquals(Boolean.FALSE, basic.getColumn().getInsertable()); //set name to null in the context model - xmlColumn.setSpecifiedInsertable(null); - assertNull(xmlColumn.getSpecifiedInsertable()); + ormColumn.setSpecifiedInsertable(null); + assertNull(ormColumn.getSpecifiedInsertable()); assertNull(basic.getColumn()); } public void testUpdateSpecifiedUnique() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedUnique()); + assertNull(ormColumn.getSpecifiedUnique()); assertNull(basic.getColumn()); //set name in the resource model, verify context model updated basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl()); basic.getColumn().setUnique(Boolean.TRUE); - assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique()); + assertEquals(Boolean.TRUE, ormColumn.getSpecifiedUnique()); assertEquals(Boolean.TRUE, basic.getColumn().getUnique()); //set name to null in the resource model basic.getColumn().setUnique(null); - assertNull(xmlColumn.getSpecifiedUnique()); + assertNull(ormColumn.getSpecifiedUnique()); assertNull(basic.getColumn().getUnique()); basic.getColumn().setUnique(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUnique()); + assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUnique()); assertEquals(Boolean.FALSE, basic.getColumn().getUnique()); basic.setColumn(null); - assertNull(xmlColumn.getSpecifiedUnique()); + assertNull(ormColumn.getSpecifiedUnique()); assertNull(basic.getColumn()); } public void testModifySpecifiedUnique() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedUnique()); + assertNull(ormColumn.getSpecifiedUnique()); assertNull(basic.getColumn()); //set name in the context model, verify resource model modified - xmlColumn.setSpecifiedUnique(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUnique()); + ormColumn.setSpecifiedUnique(Boolean.FALSE); + assertEquals(Boolean.FALSE, ormColumn.getSpecifiedUnique()); assertEquals(Boolean.FALSE, basic.getColumn().getUnique()); //set name to null in the context model - xmlColumn.setSpecifiedUnique(null); - assertNull(xmlColumn.getSpecifiedUnique()); + ormColumn.setSpecifiedUnique(null); + assertNull(ormColumn.getSpecifiedUnique()); assertNull(basic.getColumn()); } public void testUpdateSpecifiedLength() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn()); //set name in the resource model, verify context model updated basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl()); basic.getColumn().setLength(Integer.valueOf(8)); - assertEquals(Integer.valueOf(8), xmlColumn.getSpecifiedLength()); + assertEquals(Integer.valueOf(8), ormColumn.getSpecifiedLength()); assertEquals(Integer.valueOf(8), basic.getColumn().getLength()); //set name to null in the resource model basic.getColumn().setLength(null); - assertNull(xmlColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn().getLength()); basic.getColumn().setLength(Integer.valueOf(11)); - assertEquals(Integer.valueOf(11), xmlColumn.getSpecifiedLength()); + assertEquals(Integer.valueOf(11), ormColumn.getSpecifiedLength()); assertEquals(Integer.valueOf(11), basic.getColumn().getLength()); basic.setColumn(null); - assertNull(xmlColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn()); } public void testModifySpecifiedLength() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn()); //set name in the context model, verify resource model modified - xmlColumn.setSpecifiedLength(Integer.valueOf(7)); - assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedLength()); + ormColumn.setSpecifiedLength(Integer.valueOf(7)); + assertEquals(Integer.valueOf(7), ormColumn.getSpecifiedLength()); assertEquals(Integer.valueOf(7), basic.getColumn().getLength()); //set name to null in the context model - xmlColumn.setSpecifiedLength(null); - assertNull(xmlColumn.getSpecifiedLength()); + ormColumn.setSpecifiedLength(null); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn()); } public void testUpdateSpecifiedPrecision() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn()); //set name in the resource model, verify context model updated basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl()); basic.getColumn().setPrecision(Integer.valueOf(8)); - assertEquals(Integer.valueOf(8), xmlColumn.getSpecifiedPrecision()); + assertEquals(Integer.valueOf(8), ormColumn.getSpecifiedPrecision()); assertEquals(Integer.valueOf(8), basic.getColumn().getPrecision()); //set name to null in the resource model basic.getColumn().setPrecision(null); - assertNull(xmlColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn().getPrecision()); basic.getColumn().setPrecision(Integer.valueOf(11)); - assertEquals(Integer.valueOf(11), xmlColumn.getSpecifiedPrecision()); + assertEquals(Integer.valueOf(11), ormColumn.getSpecifiedPrecision()); assertEquals(Integer.valueOf(11), basic.getColumn().getPrecision()); basic.setColumn(null); - assertNull(xmlColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn()); } public void testModifySpecifiedPrecision() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn()); //set name in the context model, verify resource model modified - xmlColumn.setSpecifiedPrecision(Integer.valueOf(7)); - assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedPrecision()); + ormColumn.setSpecifiedPrecision(Integer.valueOf(7)); + assertEquals(Integer.valueOf(7), ormColumn.getSpecifiedPrecision()); assertEquals(Integer.valueOf(7), basic.getColumn().getPrecision()); //set name to null in the context model - xmlColumn.setSpecifiedPrecision(null); - assertNull(xmlColumn.getSpecifiedLength()); + ormColumn.setSpecifiedPrecision(null); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn()); } public void testUpdateSpecifiedScale() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn()); //set name in the resource model, verify context model updated basic.setColumn(OrmFactory.eINSTANCE.createColumnImpl()); basic.getColumn().setScale(Integer.valueOf(8)); - assertEquals(Integer.valueOf(8), xmlColumn.getSpecifiedScale()); + assertEquals(Integer.valueOf(8), ormColumn.getSpecifiedScale()); assertEquals(Integer.valueOf(8), basic.getColumn().getScale()); //set name to null in the resource model basic.getColumn().setScale(null); - assertNull(xmlColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn().getScale()); basic.getColumn().setScale(Integer.valueOf(11)); - assertEquals(Integer.valueOf(11), xmlColumn.getSpecifiedScale()); + assertEquals(Integer.valueOf(11), ormColumn.getSpecifiedScale()); assertEquals(Integer.valueOf(11), basic.getColumn().getScale()); basic.setColumn(null); - assertNull(xmlColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn()); } public void testModifySpecifiedScale() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); - XmlBasicMapping xmlBasicMapping = (XmlBasicMapping) xmlPersistentAttribute.getMapping(); - XmlColumn xmlColumn = xmlBasicMapping.getColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); + GenericOrmBasicMapping xmlBasicMapping = (GenericOrmBasicMapping) xmlPersistentAttribute.getMapping(); + OrmColumn ormColumn = xmlBasicMapping.getColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entityResource.getAttributes().getBasics().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entityResource.getAttributes().getBasics().get(0); - assertNull(xmlColumn.getSpecifiedLength()); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn()); //set name in the context model, verify resource model modified - xmlColumn.setSpecifiedScale(Integer.valueOf(7)); - assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale()); + ormColumn.setSpecifiedScale(Integer.valueOf(7)); + assertEquals(Integer.valueOf(7), ormColumn.getSpecifiedScale()); assertEquals(Integer.valueOf(7), basic.getColumn().getScale()); //set name to null in the context model - xmlColumn.setSpecifiedScale(null); - assertNull(xmlColumn.getSpecifiedLength()); + ormColumn.setSpecifiedScale(null); + assertNull(ormColumn.getSpecifiedLength()); assertNull(basic.getColumn()); } }
\ No newline at end of file diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlDiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlDiscriminatorColumnTests.java index 1c8df58470..6ca475ab42 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlDiscriminatorColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlDiscriminatorColumnTests.java @@ -12,17 +12,17 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.DiscriminatorType; -import org.eclipse.jpt.core.internal.context.orm.XmlDiscriminatorColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.Entity; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.DiscriminatorType; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmDiscriminatorColumn; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlEntity; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -89,11 +89,11 @@ public class XmlDiscriminatorColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlColumn.getSpecifiedName()); assertNull(entityResource.getDiscriminatorColumn()); @@ -120,11 +120,11 @@ public class XmlDiscriminatorColumnTests extends ContextModelTestCase } public void testModifySpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlColumn.getSpecifiedName()); assertNull(entityResource.getDiscriminatorColumn()); @@ -143,8 +143,8 @@ public class XmlDiscriminatorColumnTests extends ContextModelTestCase // public void testUpdateDefaultNameFromJavaTable() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName()); // // xmlEntity.javaEntity().getTable().setSpecifiedName("Foo"); @@ -170,8 +170,8 @@ public class XmlDiscriminatorColumnTests extends ContextModelTestCase // public void testUpdateDefaultNameNoJava() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertEquals("Foo", xmlEntity.getTable().getDefaultName()); // } // @@ -179,10 +179,10 @@ public class XmlDiscriminatorColumnTests extends ContextModelTestCase // createTestEntity(); // createTestSubType(); // -// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); -// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping(); -// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping(); +// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); +// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping(); +// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping(); // // assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName()); // assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName()); @@ -197,11 +197,11 @@ public class XmlDiscriminatorColumnTests extends ContextModelTestCase // } public void testUpdateSpecifiedLength() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlColumn.getSpecifiedLength()); assertNull(entityResource.getDiscriminatorColumn()); @@ -227,11 +227,11 @@ public class XmlDiscriminatorColumnTests extends ContextModelTestCase } public void testModifySpecifiedLength() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlColumn.getSpecifiedLength()); assertNull(entityResource.getDiscriminatorColumn()); @@ -248,11 +248,11 @@ public class XmlDiscriminatorColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedColumnDefinition() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlColumn.getColumnDefinition()); assertNull(entityResource.getDiscriminatorColumn()); @@ -279,11 +279,11 @@ public class XmlDiscriminatorColumnTests extends ContextModelTestCase } public void testModifySpecifiedColumnDefinition() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlColumn.getColumnDefinition()); assertNull(entityResource.getDiscriminatorColumn()); @@ -300,30 +300,30 @@ public class XmlDiscriminatorColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedDiscriminatorType() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlColumn.getSpecifiedDiscriminatorType()); assertNull(entityResource.getDiscriminatorColumn()); //set discriminator type in the resource model, verify context model updated entityResource.setDiscriminatorColumn(OrmFactory.eINSTANCE.createDiscriminatorColumn()); - entityResource.getDiscriminatorColumn().setDiscriminatorType(org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.STRING); + entityResource.getDiscriminatorColumn().setDiscriminatorType(org.eclipse.jpt.core.resource.orm.DiscriminatorType.STRING); ormResource().save(null); assertEquals(DiscriminatorType.STRING, xmlColumn.getSpecifiedDiscriminatorType()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.STRING, entityResource.getDiscriminatorColumn().getDiscriminatorType()); + assertEquals(org.eclipse.jpt.core.resource.orm.DiscriminatorType.STRING, entityResource.getDiscriminatorColumn().getDiscriminatorType()); //set discriminator type to null in the resource model entityResource.getDiscriminatorColumn().setDiscriminatorType(null); assertNull(xmlColumn.getSpecifiedDiscriminatorType()); assertNull(entityResource.getDiscriminatorColumn().getDiscriminatorType()); - entityResource.getDiscriminatorColumn().setDiscriminatorType(org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.CHAR); + entityResource.getDiscriminatorColumn().setDiscriminatorType(org.eclipse.jpt.core.resource.orm.DiscriminatorType.CHAR); assertEquals(DiscriminatorType.CHAR, xmlColumn.getSpecifiedDiscriminatorType()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.CHAR, entityResource.getDiscriminatorColumn().getDiscriminatorType()); + assertEquals(org.eclipse.jpt.core.resource.orm.DiscriminatorType.CHAR, entityResource.getDiscriminatorColumn().getDiscriminatorType()); entityResource.setDiscriminatorColumn(null); assertNull(xmlColumn.getSpecifiedDiscriminatorType()); @@ -331,11 +331,11 @@ public class XmlDiscriminatorColumnTests extends ContextModelTestCase } public void testModifySpecifiedDiscriminatorType() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmDiscriminatorColumn xmlColumn = xmlEntity.getDiscriminatorColumn(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlColumn.getSpecifiedDiscriminatorType()); assertNull(entityResource.getDiscriminatorColumn()); @@ -343,7 +343,7 @@ public class XmlDiscriminatorColumnTests extends ContextModelTestCase //set discriminator type in the context model, verify resource model modified xmlColumn.setSpecifiedDiscriminatorType(DiscriminatorType.STRING); assertEquals(DiscriminatorType.STRING, xmlColumn.getSpecifiedDiscriminatorType()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.DiscriminatorType.STRING, entityResource.getDiscriminatorColumn().getDiscriminatorType()); + assertEquals(org.eclipse.jpt.core.resource.orm.DiscriminatorType.STRING, entityResource.getDiscriminatorColumn().getDiscriminatorType()); //set discriminator type to null in the context model xmlColumn.setSpecifiedDiscriminatorType(null); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddableTests.java index 31d133ec6f..54f8a64900 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddableTests.java @@ -11,19 +11,19 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.ListIterator; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.AccessType; -import org.eclipse.jpt.core.internal.context.orm.XmlEmbeddable; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlMappedSuperclass; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.orm.Embeddable; -import org.eclipse.jpt.core.internal.resource.orm.Entity; -import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.AccessType; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEmbeddable; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmMappedSuperclass; +import org.eclipse.jpt.core.resource.orm.XmlEmbeddable; +import org.eclipse.jpt.core.resource.orm.XmlEntity; +import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlEmbeddableTests extends ContextModelTestCase @@ -43,9 +43,9 @@ public class XmlEmbeddableTests extends ContextModelTestCase } public void testUpdateClass() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping(); - Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEmbeddable xmlEmbeddable = (GenericOrmEmbeddable) ormPersistentType.getMapping(); + XmlEmbeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); assertEquals("model.Foo", xmlEmbeddable.getClass_()); assertEquals("model.Foo", embeddableResource.getClassName()); @@ -61,9 +61,9 @@ public class XmlEmbeddableTests extends ContextModelTestCase } public void testModifyClass() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping(); - Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEmbeddable xmlEmbeddable = (GenericOrmEmbeddable) ormPersistentType.getMapping(); + XmlEmbeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); assertEquals("model.Foo", xmlEmbeddable.getClass_()); assertEquals("model.Foo", embeddableResource.getClassName()); @@ -80,16 +80,16 @@ public class XmlEmbeddableTests extends ContextModelTestCase //TODO add tests for setting the className when the package is set on entity-mappings public void testUpdateSpecifiedAccess() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping(); - Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEmbeddable xmlEmbeddable = (GenericOrmEmbeddable) ormPersistentType.getMapping(); + XmlEmbeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); assertNull(xmlEmbeddable.getSpecifiedAccess()); assertNull(embeddableResource.getAccess()); //set access in the resource model, verify context model updated - embeddableResource.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD); + embeddableResource.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD); assertEquals(AccessType.FIELD, xmlEmbeddable.getSpecifiedAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, embeddableResource.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, embeddableResource.getAccess()); //set access to null in the resource model embeddableResource.setAccess(null); @@ -98,16 +98,16 @@ public class XmlEmbeddableTests extends ContextModelTestCase } public void testModifySpecifiedAccess() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping(); - Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEmbeddable xmlEmbeddable = (GenericOrmEmbeddable) ormPersistentType.getMapping(); + XmlEmbeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); assertNull(xmlEmbeddable.getSpecifiedAccess()); assertNull(embeddableResource.getAccess()); //set access in the context model, verify resource model modified xmlEmbeddable.setSpecifiedAccess(AccessType.PROPERTY); assertEquals(AccessType.PROPERTY, xmlEmbeddable.getSpecifiedAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, embeddableResource.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, embeddableResource.getAccess()); //set access to null in the context model xmlEmbeddable.setSpecifiedAccess(null); @@ -121,9 +121,9 @@ public class XmlEmbeddableTests extends ContextModelTestCase //with xml-mapping-metadata-complete set public void testUpdateSpecifiedMetadataComplete() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping(); - Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEmbeddable xmlEmbeddable = (GenericOrmEmbeddable) ormPersistentType.getMapping(); + XmlEmbeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); assertNull(embeddableResource.getMetadataComplete()); //set metadata-complete in the resource model, verify context model updated @@ -142,9 +142,9 @@ public class XmlEmbeddableTests extends ContextModelTestCase } public void testModifySpecifiedMetadataComplete() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping(); - Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEmbeddable xmlEmbeddable = (GenericOrmEmbeddable) ormPersistentType.getMapping(); + XmlEmbeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); assertNull(embeddableResource.getMetadataComplete()); //set access in the context model, verify resource model modified @@ -163,9 +163,9 @@ public class XmlEmbeddableTests extends ContextModelTestCase } public void testUpdateDefaultMetadataComplete() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping(); - Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEmbeddable xmlEmbeddable = (GenericOrmEmbeddable) ormPersistentType.getMapping(); + XmlEmbeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); assertNull(xmlEmbeddable.getSpecifiedMetadataComplete()); assertFalse(xmlEmbeddable.isDefaultMetadataComplete()); assertNull(embeddableResource.getMetadataComplete()); @@ -183,9 +183,9 @@ public class XmlEmbeddableTests extends ContextModelTestCase } public void testUpdateMetadataComplete() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) xmlPersistentType.getMapping(); - Embeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEmbeddable xmlEmbeddable = (GenericOrmEmbeddable) ormPersistentType.getMapping(); + XmlEmbeddable embeddableResource = ormResource().getEntityMappings().getEmbeddables().get(0); assertNull(xmlEmbeddable.getSpecifiedMetadataComplete()); assertFalse(xmlEmbeddable.isMetadataComplete()); assertNull(embeddableResource.getMetadataComplete()); @@ -203,23 +203,23 @@ public class XmlEmbeddableTests extends ContextModelTestCase } public void testMakeEmbeddableEntity() throws Exception { - XmlPersistentType embeddablePersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlEmbeddable embeddable = (XmlEmbeddable) embeddablePersistentType.getMapping(); + OrmPersistentType embeddablePersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEmbeddable embeddable = (GenericOrmEmbeddable) embeddablePersistentType.getMapping(); embeddable.setSpecifiedAccess(AccessType.PROPERTY); embeddable.setSpecifiedMetadataComplete(Boolean.TRUE); ormResource().save(null); - embeddablePersistentType.setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY); + embeddablePersistentType.setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY); ormResource().save(null); - Entity entity = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entity = ormResource().getEntityMappings().getEntities().get(0); assertEquals("model.Foo", entity.getClassName()); assertEquals(Boolean.TRUE, entity.getMetadataComplete()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, entity.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, entity.getAccess()); assertNull(entity.getDiscriminatorValue()); assertNull(entity.getName()); - XmlEntity xmlEntity = (XmlEntity) embeddablePersistentType.getMapping(); + GenericOrmEntity xmlEntity = (GenericOrmEntity) embeddablePersistentType.getMapping(); assertEquals("model.Foo", xmlEntity.getClass_()); assertEquals(Boolean.TRUE, xmlEntity.getSpecifiedMetadataComplete()); assertEquals(AccessType.PROPERTY, xmlEntity.getSpecifiedAccess()); @@ -227,49 +227,49 @@ public class XmlEmbeddableTests extends ContextModelTestCase //test with 2 Embeddables, make the second one an Entity so it has to move to the front of the list public void testMakeEmbeddableEntity2() throws Exception { - entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo2"); - XmlPersistentType embeddablePersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlEmbeddable embeddable = (XmlEmbeddable) embeddablePersistentType.getMapping(); + entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo2"); + OrmPersistentType embeddablePersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEmbeddable embeddable = (GenericOrmEmbeddable) embeddablePersistentType.getMapping(); embeddable.setSpecifiedAccess(AccessType.PROPERTY); embeddable.setSpecifiedMetadataComplete(Boolean.TRUE); ormResource().save(null); - embeddablePersistentType.setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY); + embeddablePersistentType.setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY); ormResource().save(null); - Entity entity = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entity = ormResource().getEntityMappings().getEntities().get(0); assertEquals("model.Foo", entity.getClassName()); assertEquals(Boolean.TRUE, entity.getMetadataComplete()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, entity.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, entity.getAccess()); assertNull(entity.getDiscriminatorValue()); assertNull(entity.getName()); - XmlEntity xmlEntity = (XmlEntity) embeddablePersistentType.getMapping(); + GenericOrmEntity xmlEntity = (GenericOrmEntity) embeddablePersistentType.getMapping(); assertEquals("model.Foo", xmlEntity.getClass_()); assertEquals(Boolean.TRUE, xmlEntity.getSpecifiedMetadataComplete()); assertEquals(AccessType.PROPERTY, xmlEntity.getSpecifiedAccess()); - ListIterator<XmlPersistentType> persistentTypes = entityMappings().xmlPersistentTypes(); - assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); - assertEquals(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); + ListIterator<OrmPersistentType> persistentTypes = entityMappings().ormPersistentTypes(); + assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); + assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); } public void testMakeEmbeddableMappedSuperclass() throws Exception { - XmlPersistentType embeddablePersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlEmbeddable embeddable = (XmlEmbeddable) embeddablePersistentType.getMapping(); + OrmPersistentType embeddablePersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEmbeddable embeddable = (GenericOrmEmbeddable) embeddablePersistentType.getMapping(); embeddable.setSpecifiedAccess(AccessType.PROPERTY); embeddable.setSpecifiedMetadataComplete(Boolean.TRUE); ormResource().save(null); - embeddablePersistentType.setMappingKey(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); + embeddablePersistentType.setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); ormResource().save(null); - MappedSuperclass mappedSuperclass = ormResource().getEntityMappings().getMappedSuperclasses().get(0); + XmlMappedSuperclass mappedSuperclass = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertEquals("model.Foo", mappedSuperclass.getClassName()); assertEquals(Boolean.TRUE, mappedSuperclass.getMetadataComplete()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess()); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) embeddablePersistentType.getMapping(); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) embeddablePersistentType.getMapping(); assertEquals("model.Foo", xmlMappedSuperclass.getClass_()); assertEquals(Boolean.TRUE, xmlMappedSuperclass.getSpecifiedMetadataComplete()); assertEquals(AccessType.PROPERTY, xmlMappedSuperclass.getSpecifiedAccess()); @@ -277,29 +277,29 @@ public class XmlEmbeddableTests extends ContextModelTestCase //test with 2 Embeddables, make the second one a MappedSuperclass so it has to move to the front of the list public void testMakeEmbeddableMappedSuperclass2() throws Exception { - entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo2"); - XmlPersistentType embeddablePersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlEmbeddable embeddable = (XmlEmbeddable) embeddablePersistentType.getMapping(); + entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo2"); + OrmPersistentType embeddablePersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEmbeddable embeddable = (GenericOrmEmbeddable) embeddablePersistentType.getMapping(); embeddable.setSpecifiedAccess(AccessType.PROPERTY); embeddable.setSpecifiedMetadataComplete(Boolean.TRUE); ormResource().save(null); - embeddablePersistentType.setMappingKey(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); + embeddablePersistentType.setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); ormResource().save(null); - MappedSuperclass mappedSuperclass = ormResource().getEntityMappings().getMappedSuperclasses().get(0); + XmlMappedSuperclass mappedSuperclass = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertEquals("model.Foo", mappedSuperclass.getClassName()); assertEquals(Boolean.TRUE, mappedSuperclass.getMetadataComplete()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess()); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) embeddablePersistentType.getMapping(); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) embeddablePersistentType.getMapping(); assertEquals("model.Foo", xmlMappedSuperclass.getClass_()); assertEquals(Boolean.TRUE, xmlMappedSuperclass.getSpecifiedMetadataComplete()); assertEquals(AccessType.PROPERTY, xmlMappedSuperclass.getSpecifiedAccess()); - ListIterator<XmlPersistentType> persistentTypes = entityMappings().xmlPersistentTypes(); - assertEquals(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); - assertEquals(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); + ListIterator<OrmPersistentType> persistentTypes = entityMappings().ormPersistentTypes(); + assertEquals(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); + assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); } }
\ No newline at end of file diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedIdMappingTests.java index 68cb0c7bb6..e40933b5c9 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedIdMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedIdMappingTests.java @@ -12,24 +12,24 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.IAttributeOverride; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.AttributeOverride; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -109,8 +109,8 @@ public class XmlEmbeddedIdMappingTests extends ContextModelTestCase // public void testUpdateName() throws Exception { -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping"); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping"); // XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); // EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0); // @@ -129,8 +129,8 @@ public class XmlEmbeddedIdMappingTests extends ContextModelTestCase // } // // public void testModifyName() throws Exception { -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping"); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping"); // XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); // EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0); // @@ -149,8 +149,8 @@ public class XmlEmbeddedIdMappingTests extends ContextModelTestCase // } // // public void testAddSpecifiedAttributeOverride() throws Exception { -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping"); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping"); // XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); // EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0); // @@ -190,8 +190,8 @@ public class XmlEmbeddedIdMappingTests extends ContextModelTestCase // } // // public void testRemoveSpecifiedAttributeOverride() throws Exception { -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping"); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping"); // XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); // EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0); // @@ -215,8 +215,8 @@ public class XmlEmbeddedIdMappingTests extends ContextModelTestCase // } // // public void testMoveSpecifiedAttributeOverride() throws Exception { -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping"); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping"); // XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); // EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0); // @@ -250,8 +250,8 @@ public class XmlEmbeddedIdMappingTests extends ContextModelTestCase // } // // public void testUpdateAttributeOverrides() throws Exception { -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping"); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedIdMapping"); // XmlEmbeddedIdMapping xmlEmbeddedIdMapping = (XmlEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); // EmbeddedId embeddedIdResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddedIds().get(0); // @@ -300,173 +300,173 @@ public class XmlEmbeddedIdMappingTests extends ContextModelTestCase public void testEmbeddedIdMorphToIdMapping() throws Exception { createTestEntityEmbeddedIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedIdMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedIdMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof IdMapping); assertEquals("embeddedId", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedIdMorphToVersionMapping() throws Exception { createTestEntityEmbeddedIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedIdMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedIdMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IVersionMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof VersionMapping); assertEquals("embeddedId", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedIdMorphToTransientMapping() throws Exception { createTestEntityEmbeddedIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedIdMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedIdMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof ITransientMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof TransientMapping); assertEquals("embeddedId", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedIdMorphToBasicMapping() throws Exception { createTestEntityEmbeddedIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedIdMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedIdMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IBasicMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof BasicMapping); assertEquals("embeddedId", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedIdMorphToEmbeddedMapping() throws Exception { createTestEntityEmbeddedIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedIdMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedIdMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedMapping); assertEquals("embeddedId", xmlPersistentAttribute.getMapping().getName()); - attributeOverride = ((IEmbeddedMapping) xmlPersistentAttribute.getMapping()).specifiedAttributeOverrides().next(); + attributeOverride = ((EmbeddedMapping) xmlPersistentAttribute.getMapping()).specifiedAttributeOverrides().next(); assertEquals("override", attributeOverride.getName()); assertEquals("OVERRIDE_COLUMN", attributeOverride.getColumn().getSpecifiedName()); } public void testEmbeddedIdMorphToOneToOneMapping() throws Exception { createTestEntityEmbeddedIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedIdMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedIdMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToOneMapping); assertEquals("embeddedId", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedIdMorphToOneToManyMapping() throws Exception { createTestEntityEmbeddedIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedIdMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedIdMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToManyMapping); assertEquals("embeddedId", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedIdMorphToManyToOneMapping() throws Exception { createTestEntityEmbeddedIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedIdMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedIdMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToOneMapping); assertEquals("embeddedId", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedIdMorphToManyToManyMapping() throws Exception { createTestEntityEmbeddedIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, "embeddedId"); - IEmbeddedIdMapping embeddedIdMapping = (IEmbeddedIdMapping) xmlPersistentAttribute.getMapping(); + EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedIdMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedIdMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedIdMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToManyMapping); assertEquals("embeddedId", xmlPersistentAttribute.getMapping().getName()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedMappingTests.java index 3debabfaff..b01496a5c4 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEmbeddedMappingTests.java @@ -13,29 +13,29 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.IAttributeOverride; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlAttributeOverride; -import org.eclipse.jpt.core.internal.context.orm.XmlColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.Embedded; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.AttributeOverride; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmAttributeOverride; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmColumn; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEmbeddedMapping; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlEmbedded; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -154,10 +154,10 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping"); - XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping(); - Embedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping"); + GenericOrmEmbeddedMapping xmlEmbeddedMapping = (GenericOrmEmbeddedMapping) xmlPersistentAttribute.getMapping(); + XmlEmbedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0); assertEquals("embeddedMapping", xmlEmbeddedMapping.getName()); assertEquals("embeddedMapping", embeddedResource.getName()); @@ -174,10 +174,10 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping"); - XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping(); - Embedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping"); + GenericOrmEmbeddedMapping xmlEmbeddedMapping = (GenericOrmEmbeddedMapping) xmlPersistentAttribute.getMapping(); + XmlEmbedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0); assertEquals("embeddedMapping", xmlEmbeddedMapping.getName()); assertEquals("embeddedMapping", embeddedResource.getName()); @@ -194,19 +194,19 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase } public void testAddSpecifiedAttributeOverride() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping"); - XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping(); - Embedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping"); + GenericOrmEmbeddedMapping xmlEmbeddedMapping = (GenericOrmEmbeddedMapping) xmlPersistentAttribute.getMapping(); + XmlEmbedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0); - XmlAttributeOverride attributeOverride = xmlEmbeddedMapping.addSpecifiedAttributeOverride(0); + GenericOrmAttributeOverride attributeOverride = xmlEmbeddedMapping.addSpecifiedAttributeOverride(0); ormResource().save(null); attributeOverride.setName("FOO"); ormResource().save(null); assertEquals("FOO", embeddedResource.getAttributeOverrides().get(0).getName()); - XmlAttributeOverride attributeOverride2 = xmlEmbeddedMapping.addSpecifiedAttributeOverride(0); + GenericOrmAttributeOverride attributeOverride2 = xmlEmbeddedMapping.addSpecifiedAttributeOverride(0); ormResource().save(null); attributeOverride2.setName("BAR"); ormResource().save(null); @@ -214,7 +214,7 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase assertEquals("BAR", embeddedResource.getAttributeOverrides().get(0).getName()); assertEquals("FOO", embeddedResource.getAttributeOverrides().get(1).getName()); - XmlAttributeOverride attributeOverride3 = xmlEmbeddedMapping.addSpecifiedAttributeOverride(1); + GenericOrmAttributeOverride attributeOverride3 = xmlEmbeddedMapping.addSpecifiedAttributeOverride(1); ormResource().save(null); attributeOverride3.setName("BAZ"); ormResource().save(null); @@ -223,7 +223,7 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase assertEquals("BAZ", embeddedResource.getAttributeOverrides().get(1).getName()); assertEquals("FOO", embeddedResource.getAttributeOverrides().get(2).getName()); - ListIterator<XmlAttributeOverride> attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides(); + ListIterator<GenericOrmAttributeOverride> attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides(); assertEquals(attributeOverride2, attributeOverrides.next()); assertEquals(attributeOverride3, attributeOverrides.next()); assertEquals(attributeOverride, attributeOverrides.next()); @@ -235,10 +235,10 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase } public void testRemoveSpecifiedAttributeOverride() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping"); - XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping(); - Embedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping"); + GenericOrmEmbeddedMapping xmlEmbeddedMapping = (GenericOrmEmbeddedMapping) xmlPersistentAttribute.getMapping(); + XmlEmbedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0); xmlEmbeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO"); xmlEmbeddedMapping.addSpecifiedAttributeOverride(1).setName("BAR"); @@ -260,10 +260,10 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase } public void testMoveSpecifiedAttributeOverride() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping"); - XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping(); - Embedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping"); + GenericOrmEmbeddedMapping xmlEmbeddedMapping = (GenericOrmEmbeddedMapping) xmlPersistentAttribute.getMapping(); + XmlEmbedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0); xmlEmbeddedMapping.addSpecifiedAttributeOverride(0).setName("FOO"); xmlEmbeddedMapping.addSpecifiedAttributeOverride(1).setName("BAR"); @@ -273,7 +273,7 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase xmlEmbeddedMapping.moveSpecifiedAttributeOverride(2, 0); - ListIterator<XmlAttributeOverride> attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides(); + ListIterator<GenericOrmAttributeOverride> attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides(); assertEquals("BAR", attributeOverrides.next().getName()); assertEquals("BAZ", attributeOverrides.next().getName()); assertEquals("FOO", attributeOverrides.next().getName()); @@ -295,10 +295,10 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase } public void testUpdateAttributeOverrides() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping"); - XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping(); - Embedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedMapping"); + GenericOrmEmbeddedMapping xmlEmbeddedMapping = (GenericOrmEmbeddedMapping) xmlPersistentAttribute.getMapping(); + XmlEmbedded embeddedResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getEmbeddeds().get(0); embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl()); embeddedResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl()); @@ -308,7 +308,7 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase embeddedResource.getAttributeOverrides().get(1).setName("BAR"); embeddedResource.getAttributeOverrides().get(2).setName("BAZ"); - ListIterator<XmlAttributeOverride> attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides(); + ListIterator<GenericOrmAttributeOverride> attributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides(); assertEquals("FOO", attributeOverrides.next().getName()); assertEquals("BAR", attributeOverrides.next().getName()); assertEquals("BAZ", attributeOverrides.next().getName()); @@ -348,13 +348,13 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase createTestEntityEmbeddedMapping(); createTestEmbeddableAddress(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "foo"); - assertEquals(3, xmlPersistentType.virtualAttributesSize()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "foo"); + assertEquals(3, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmEmbeddedMapping xmlEmbeddedMapping = (GenericOrmEmbeddedMapping) xmlPersistentAttribute.getMapping(); assertEquals("foo", xmlEmbeddedMapping.getName()); @@ -368,21 +368,21 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase createTestEntityEmbeddedMapping(); createTestEmbeddableAddress(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); - assertEquals(3, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); + assertEquals(3, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping(); + GenericOrmEmbeddedMapping xmlEmbeddedMapping = (GenericOrmEmbeddedMapping) xmlPersistentAttribute.getMapping(); assertEquals("address", xmlEmbeddedMapping.getName()); assertEquals(4, xmlEmbeddedMapping.specifiedAttributeOverridesSize()); assertEquals(0, xmlEmbeddedMapping.defaultAttributeOverridesSize()); - ListIterator<XmlAttributeOverride> xmlAttributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides(); + ListIterator<GenericOrmAttributeOverride> xmlAttributeOverrides = xmlEmbeddedMapping.specifiedAttributeOverrides(); - XmlAttributeOverride xmlAttributeOverride = xmlAttributeOverrides.next(); + GenericOrmAttributeOverride xmlAttributeOverride = xmlAttributeOverrides.next(); assertEquals(ATTRIBUTE_OVERRIDE_NAME, xmlAttributeOverride.getName()); - XmlColumn xmlColumn = xmlAttributeOverride.getColumn(); + GenericOrmColumn xmlColumn = xmlAttributeOverride.getColumn(); assertEquals(ATTRIBUTE_OVERRIDE_COLUMN_NAME, xmlColumn.getSpecifiedName()); // assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique()); // assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable()); @@ -415,13 +415,13 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase createTestEntityEmbeddedMapping(); createTestEmbeddableAddress(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); - xmlPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); - assertEquals(3, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); + ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); + assertEquals(3, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping(); + GenericOrmEmbeddedMapping xmlEmbeddedMapping = (GenericOrmEmbeddedMapping) xmlPersistentAttribute.getMapping(); assertEquals("address", xmlEmbeddedMapping.getName()); //TODO @@ -463,14 +463,14 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase createTestEntityEmbeddedMapping(); createTestEmbeddableAddress(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "address"); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "address"); + assertEquals(2, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlEmbeddedMapping xmlEmbeddedMapping = (XmlEmbeddedMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmEmbeddedMapping xmlEmbeddedMapping = (GenericOrmEmbeddedMapping) xmlPersistentAttribute.getMapping(); assertEquals("address", xmlEmbeddedMapping.getName()); @@ -512,173 +512,173 @@ public class XmlEmbeddedMappingTests extends ContextModelTestCase public void testEmbeddedMorphToIdMapping() throws Exception { createTestEntityEmbeddedMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) xmlPersistentAttribute.getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof IdMapping); assertEquals("embedded", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedMorphToVersionMapping() throws Exception { createTestEntityEmbeddedMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) xmlPersistentAttribute.getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IVersionMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof VersionMapping); assertEquals("embedded", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedMorphToTransientMapping() throws Exception { createTestEntityEmbeddedMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) xmlPersistentAttribute.getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof ITransientMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof TransientMapping); assertEquals("embedded", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedMorphToBasicMapping() throws Exception { createTestEntityEmbeddedMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) xmlPersistentAttribute.getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IBasicMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof BasicMapping); assertEquals("embedded", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedMorphToEmbeddedIdMapping() throws Exception { createTestEntityEmbeddedMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) xmlPersistentAttribute.getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedIdMapping); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedIdMapping); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); assertEquals("embedded", xmlPersistentAttribute.getMapping().getName()); - attributeOverride = ((IEmbeddedIdMapping) xmlPersistentAttribute.getMapping()).specifiedAttributeOverrides().next(); + attributeOverride = ((EmbeddedIdMapping) xmlPersistentAttribute.getMapping()).specifiedAttributeOverrides().next(); assertEquals("override", attributeOverride.getName()); assertEquals("OVERRIDE_COLUMN", attributeOverride.getColumn().getSpecifiedName()); } public void testEmbeddedMorphToOneToOneMapping() throws Exception { createTestEntityEmbeddedMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) xmlPersistentAttribute.getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToOneMapping); assertEquals("embedded", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedMorphToOneToManyMapping() throws Exception { createTestEntityEmbeddedMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) xmlPersistentAttribute.getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToManyMapping); assertEquals("embedded", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedMorphToManyToOneMapping() throws Exception { createTestEntityEmbeddedMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) xmlPersistentAttribute.getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToOneMapping); assertEquals("embedded", xmlPersistentAttribute.getMapping().getName()); } public void testEmbeddedMorphToManyToManyMapping() throws Exception { createTestEntityEmbeddedMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embedded"); - IEmbeddedMapping embeddedMapping = (IEmbeddedMapping) xmlPersistentAttribute.getMapping(); + EmbeddedMapping embeddedMapping = (EmbeddedMapping) xmlPersistentAttribute.getMapping(); assertFalse(embeddedMapping.isDefault()); - IAttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); + AttributeOverride attributeOverride = embeddedMapping.addSpecifiedAttributeOverride(0); attributeOverride.setName("override"); attributeOverride.getColumn().setSpecifiedName("OVERRIDE_COLUMN"); assertFalse(embeddedMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToManyMapping); assertEquals("embedded", xmlPersistentAttribute.getMapping().getName()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEntityTests.java index d385300979..9c241a584d 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEntityTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlEntityTests.java @@ -13,27 +13,27 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.AccessType; -import org.eclipse.jpt.core.internal.context.base.InheritanceType; -import org.eclipse.jpt.core.internal.context.orm.XmlAssociationOverride; -import org.eclipse.jpt.core.internal.context.orm.XmlAttributeOverride; -import org.eclipse.jpt.core.internal.context.orm.XmlEmbeddable; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlMappedSuperclass; -import org.eclipse.jpt.core.internal.context.orm.XmlNamedNativeQuery; -import org.eclipse.jpt.core.internal.context.orm.XmlNamedQuery; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.orm.XmlPrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlSecondaryTable; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.Embeddable; -import org.eclipse.jpt.core.internal.resource.orm.Entity; -import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.AccessType; +import org.eclipse.jpt.core.context.InheritanceType; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmAssociationOverride; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmAttributeOverride; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmPrimaryKeyJoinColumn; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmSecondaryTable; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEmbeddable; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmMappedSuperclass; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmNamedNativeQuery; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmNamedQuery; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlEmbeddable; +import org.eclipse.jpt.core.resource.orm.XmlEntity; +import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -136,9 +136,9 @@ public class XmlEntityTests extends ContextModelTestCase public void testUpdateSpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedName()); assertNull(entityResource.getName()); @@ -154,9 +154,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testModifySpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedName()); assertNull(entityResource.getName()); @@ -174,9 +174,9 @@ public class XmlEntityTests extends ContextModelTestCase public void testUpdateDefaultName() throws Exception { createTestEntityFieldAccess(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(TYPE_NAME, xmlEntity.getDefaultName()); xmlEntity.javaEntity().setSpecifiedName("Foo"); @@ -193,9 +193,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals("Foo", xmlEntity.getName()); //set class in the resource model, verify context model updated @@ -214,9 +214,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateClass() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals("model.Foo", xmlEntity.getClass_()); assertEquals("model.Foo", entityResource.getClassName()); @@ -232,9 +232,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testModifyClass() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals("model.Foo", xmlEntity.getClass_()); assertEquals("model.Foo", entityResource.getClassName()); @@ -251,17 +251,17 @@ public class XmlEntityTests extends ContextModelTestCase //TODO add tests for setting the className when the package is set on entity-mappings public void testUpdateSpecifiedAccess() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedAccess()); assertNull(entityResource.getAccess()); //set access in the resource model, verify context model updated - entityResource.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD); + entityResource.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD); ormResource().save(null); assertEquals(AccessType.FIELD, xmlEntity.getSpecifiedAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, entityResource.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, entityResource.getAccess()); //set access to null in the resource model entityResource.setAccess(null); @@ -270,16 +270,16 @@ public class XmlEntityTests extends ContextModelTestCase } public void testModifySpecifiedAccess() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedAccess()); assertNull(entityResource.getAccess()); //set access in the context model, verify resource model modified xmlEntity.setSpecifiedAccess(AccessType.PROPERTY); assertEquals(AccessType.PROPERTY, xmlEntity.getSpecifiedAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, entityResource.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, entityResource.getAccess()); //set access to null in the context model xmlEntity.setSpecifiedAccess(null); @@ -288,21 +288,21 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateDefaultAccessFromPersistenceUnitDefaults() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedAccess()); assertNull(xmlEntity.getDefaultAccess()); assertNull(entityResource.getAccess()); ormResource().getEntityMappings().setPersistenceUnitMetadata(OrmFactory.eINSTANCE.createPersistenceUnitMetadata()); ormResource().getEntityMappings().getPersistenceUnitMetadata().setPersistenceUnitDefaults(OrmFactory.eINSTANCE.createPersistenceUnitDefaults()); - ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD); + ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD); assertEquals(AccessType.FIELD, xmlEntity.getDefaultAccess()); assertNull(xmlEntity.getSpecifiedAccess()); assertNull(entityResource.getAccess()); - ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY); + ormResource().getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY); assertEquals(AccessType.PROPERTY, xmlEntity.getDefaultAccess()); assertNull(xmlEntity.getSpecifiedAccess()); assertNull(entityResource.getAccess()); @@ -316,8 +316,8 @@ public class XmlEntityTests extends ContextModelTestCase public void testUpdateDefaultAccessFromJava() throws Exception { createTestEntityDefaultFieldAccess(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); //java has no annotations, so defaultAccess in xml is null assertNull(xmlEntity.getDefaultAccess()); @@ -333,7 +333,7 @@ public class XmlEntityTests extends ContextModelTestCase entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(null); assertNull(xmlEntity.getDefaultAccess()); - xmlPersistentType.javaPersistentType().attributeNamed("id").setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + ormPersistentType.javaPersistentType().attributeNamed("id").setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); //java has annotations on fields now, that should win in all cases assertEquals(AccessType.FIELD, xmlEntity.getDefaultAccess()); @@ -341,15 +341,15 @@ public class XmlEntityTests extends ContextModelTestCase entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY); assertEquals(AccessType.FIELD, xmlEntity.getDefaultAccess()); - xmlPersistentType.javaPersistentType().attributeNamed("id").setSpecifiedMappingKey(IMappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); + ormPersistentType.javaPersistentType().attributeNamed("id").setSpecifiedMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY); assertEquals(AccessType.PROPERTY, xmlEntity.getDefaultAccess()); } public void testUpdateDefaultAccessFromJavaFieldAccess() throws Exception { createTestEntityFieldAccess(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertEquals(AccessType.FIELD, xmlEntity.getDefaultAccess()); xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE); @@ -371,8 +371,8 @@ public class XmlEntityTests extends ContextModelTestCase public void testUpdateDefaultAccessFromJavaPropertyAccess() throws Exception { createTestEntityPropertyAccess(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertEquals(AccessType.PROPERTY, xmlEntity.getDefaultAccess()); xmlEntity.setSpecifiedMetadataComplete(Boolean.TRUE); @@ -392,15 +392,15 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateDefaultAccessNoUnderlyingJava() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertNull(xmlEntity.getDefaultAccess()); } public void testUpdateSpecifiedMetadataComplete() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedMetadataComplete()); assertNull(entityResource.getMetadataComplete()); @@ -423,9 +423,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testModifySpecifiedMetadataComplete() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedMetadataComplete()); assertNull(entityResource.getMetadataComplete()); @@ -445,9 +445,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateDefaultMetadataComplete() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedMetadataComplete()); assertFalse(xmlEntity.isDefaultMetadataComplete()); assertNull(entityResource.getMetadataComplete()); @@ -471,9 +471,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateMetadataComplete() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedMetadataComplete()); assertFalse(xmlEntity.isMetadataComplete()); assertNull(entityResource.getMetadataComplete()); @@ -492,25 +492,25 @@ public class XmlEntityTests extends ContextModelTestCase public void testUpdateInheritanceStrategy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(InheritanceType.SINGLE_TABLE, xmlEntity.getInheritanceStrategy()); assertNull(entityResource.getInheritance()); //set inheritance strategy in the resource model, verify context model updated entityResource.setInheritance(OrmFactory.eINSTANCE.createInheritance()); - entityResource.getInheritance().setStrategy(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.TABLE_PER_CLASS); + entityResource.getInheritance().setStrategy(org.eclipse.jpt.core.resource.orm.InheritanceType.TABLE_PER_CLASS); assertEquals(InheritanceType.TABLE_PER_CLASS, xmlEntity.getInheritanceStrategy()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.TABLE_PER_CLASS, entityResource.getInheritance().getStrategy()); + assertEquals(org.eclipse.jpt.core.resource.orm.InheritanceType.TABLE_PER_CLASS, entityResource.getInheritance().getStrategy()); } public void testUpdateDefaultInheritanceStrategyFromJava() throws Exception { createTestEntityDefaultFieldAccess(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); //no inheritance strategy specified in java so single-table is default assertEquals(InheritanceType.SINGLE_TABLE, xmlEntity.getDefaultInheritanceStrategy()); @@ -542,10 +542,10 @@ public class XmlEntityTests extends ContextModelTestCase createTestEntityDefaultFieldAccess(); createTestSubType(); - XmlPersistentType parentPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentType childPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); - XmlEntity parentXmlEntity = (XmlEntity) parentPersistentType.getMapping(); - XmlEntity childXmlEntity = (XmlEntity) childPersistentType.getMapping(); + OrmPersistentType parentPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType childPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); + GenericOrmEntity parentXmlEntity = (GenericOrmEntity) parentPersistentType.getMapping(); + GenericOrmEntity childXmlEntity = (GenericOrmEntity) childPersistentType.getMapping(); assertEquals(parentXmlEntity, childXmlEntity.parentEntity()); assertEquals(InheritanceType.SINGLE_TABLE, childXmlEntity.getDefaultInheritanceStrategy()); @@ -570,26 +570,26 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateSpecifiedInheritanceStrategy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedInheritanceStrategy()); assertNull(entityResource.getInheritance()); //set strategy in the resource model, verify context model updated entityResource.setInheritance(OrmFactory.eINSTANCE.createInheritance()); - entityResource.getInheritance().setStrategy(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.JOINED); + entityResource.getInheritance().setStrategy(org.eclipse.jpt.core.resource.orm.InheritanceType.JOINED); assertEquals(InheritanceType.JOINED, xmlEntity.getSpecifiedInheritanceStrategy()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.JOINED, entityResource.getInheritance().getStrategy()); + assertEquals(org.eclipse.jpt.core.resource.orm.InheritanceType.JOINED, entityResource.getInheritance().getStrategy()); //set strategy to null in the resource model entityResource.getInheritance().setStrategy(null); assertNull(xmlEntity.getSpecifiedInheritanceStrategy()); assertNull(entityResource.getInheritance().getStrategy()); - entityResource.getInheritance().setStrategy(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.SINGLE_TABLE); + entityResource.getInheritance().setStrategy(org.eclipse.jpt.core.resource.orm.InheritanceType.SINGLE_TABLE); assertEquals(InheritanceType.SINGLE_TABLE, xmlEntity.getSpecifiedInheritanceStrategy()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.SINGLE_TABLE, entityResource.getInheritance().getStrategy()); + assertEquals(org.eclipse.jpt.core.resource.orm.InheritanceType.SINGLE_TABLE, entityResource.getInheritance().getStrategy()); entityResource.setInheritance(null); assertNull(xmlEntity.getSpecifiedInheritanceStrategy()); @@ -597,16 +597,16 @@ public class XmlEntityTests extends ContextModelTestCase } public void testModifySpecifiedInheritanceStrategy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedInheritanceStrategy()); assertNull(entityResource.getInheritance()); //set strategy in the context model, verify resource model modified xmlEntity.setSpecifiedInheritanceStrategy(InheritanceType.TABLE_PER_CLASS); assertEquals(InheritanceType.TABLE_PER_CLASS, xmlEntity.getSpecifiedInheritanceStrategy()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.InheritanceType.TABLE_PER_CLASS, entityResource.getInheritance().getStrategy()); + assertEquals(org.eclipse.jpt.core.resource.orm.InheritanceType.TABLE_PER_CLASS, entityResource.getInheritance().getStrategy()); //set strategy to null in the context model xmlEntity.setSpecifiedInheritanceStrategy(null); @@ -615,18 +615,18 @@ public class XmlEntityTests extends ContextModelTestCase } public void testAddSpecifiedSecondaryTable() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); - XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + GenericOrmSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); ormResource().save(null); secondaryTable.setSpecifiedName("FOO"); ormResource().save(null); assertEquals("FOO", entityResource.getSecondaryTables().get(0).getName()); - XmlSecondaryTable secondaryTable2 = xmlEntity.addSpecifiedSecondaryTable(0); + GenericOrmSecondaryTable secondaryTable2 = xmlEntity.addSpecifiedSecondaryTable(0); ormResource().save(null); secondaryTable2.setSpecifiedName("BAR"); ormResource().save(null); @@ -634,7 +634,7 @@ public class XmlEntityTests extends ContextModelTestCase assertEquals("BAR", entityResource.getSecondaryTables().get(0).getName()); assertEquals("FOO", entityResource.getSecondaryTables().get(1).getName()); - XmlSecondaryTable secondaryTable3 = xmlEntity.addSpecifiedSecondaryTable(1); + GenericOrmSecondaryTable secondaryTable3 = xmlEntity.addSpecifiedSecondaryTable(1); ormResource().save(null); secondaryTable3.setSpecifiedName("BAZ"); ormResource().save(null); @@ -643,7 +643,7 @@ public class XmlEntityTests extends ContextModelTestCase assertEquals("BAZ", entityResource.getSecondaryTables().get(1).getName()); assertEquals("FOO", entityResource.getSecondaryTables().get(2).getName()); - ListIterator<XmlSecondaryTable> secondaryTables = xmlEntity.specifiedSecondaryTables(); + ListIterator<GenericOrmSecondaryTable> secondaryTables = xmlEntity.specifiedSecondaryTables(); assertEquals(secondaryTable2, secondaryTables.next()); assertEquals(secondaryTable3, secondaryTables.next()); assertEquals(secondaryTable, secondaryTables.next()); @@ -655,14 +655,14 @@ public class XmlEntityTests extends ContextModelTestCase } public void testRemoveSpecifiedSecondaryTable() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); xmlEntity.addSpecifiedSecondaryTable(0).setSpecifiedName("FOO"); xmlEntity.addSpecifiedSecondaryTable(1).setSpecifiedName("BAR"); xmlEntity.addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ"); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(3, entityResource.getSecondaryTables().size()); xmlEntity.removeSpecifiedSecondaryTable(0); @@ -679,19 +679,19 @@ public class XmlEntityTests extends ContextModelTestCase } public void testMoveSpecifiedSecondaryTable() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); xmlEntity.addSpecifiedSecondaryTable(0).setSpecifiedName("FOO"); xmlEntity.addSpecifiedSecondaryTable(1).setSpecifiedName("BAR"); xmlEntity.addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ"); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(3, entityResource.getSecondaryTables().size()); xmlEntity.moveSpecifiedSecondaryTable(2, 0); - ListIterator<XmlSecondaryTable> secondaryTables = xmlEntity.specifiedSecondaryTables(); + ListIterator<GenericOrmSecondaryTable> secondaryTables = xmlEntity.specifiedSecondaryTables(); assertEquals("BAR", secondaryTables.next().getName()); assertEquals("BAZ", secondaryTables.next().getName()); assertEquals("FOO", secondaryTables.next().getName()); @@ -713,10 +713,10 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateSecondaryTables() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createSecondaryTable()); entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createSecondaryTable()); entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createSecondaryTable()); @@ -725,7 +725,7 @@ public class XmlEntityTests extends ContextModelTestCase entityResource.getSecondaryTables().get(1).setName("BAR"); entityResource.getSecondaryTables().get(2).setName("BAZ"); - ListIterator<XmlSecondaryTable> secondaryTables = xmlEntity.specifiedSecondaryTables(); + ListIterator<GenericOrmSecondaryTable> secondaryTables = xmlEntity.specifiedSecondaryTables(); assertEquals("FOO", secondaryTables.next().getName()); assertEquals("BAR", secondaryTables.next().getName()); assertEquals("BAZ", secondaryTables.next().getName()); @@ -767,10 +767,10 @@ public class XmlEntityTests extends ContextModelTestCase createTestEntityDefaultFieldAccess(); createTestSubType(); - XmlPersistentType parentPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentType childPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); - XmlEntity parentXmlEntity = (XmlEntity) parentPersistentType.getMapping(); - XmlEntity childXmlEntity = (XmlEntity) childPersistentType.getMapping(); + OrmPersistentType parentPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType childPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); + GenericOrmEntity parentXmlEntity = (GenericOrmEntity) parentPersistentType.getMapping(); + GenericOrmEntity childXmlEntity = (GenericOrmEntity) childPersistentType.getMapping(); childXmlEntity.javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("FOO"); @@ -781,8 +781,8 @@ public class XmlEntityTests extends ContextModelTestCase assertEquals(1, childXmlEntity.secondaryTablesSize()); childXmlEntity.javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAR"); - ListIterator<XmlSecondaryTable> virtualSecondaryTables = childXmlEntity.virtualSecondaryTables(); - ListIterator<XmlSecondaryTable> secondaryTables = childXmlEntity.secondaryTables(); + ListIterator<GenericOrmSecondaryTable> virtualSecondaryTables = childXmlEntity.virtualSecondaryTables(); + ListIterator<GenericOrmSecondaryTable> secondaryTables = childXmlEntity.secondaryTables(); assertEquals("BAR", virtualSecondaryTables.next().getName()); assertEquals("FOO", virtualSecondaryTables.next().getName()); assertEquals("BAR", secondaryTables.next().getName()); @@ -852,8 +852,8 @@ public class XmlEntityTests extends ContextModelTestCase } public void testMakeEntityEmbeddable() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity entity = (XmlEntity) entityPersistentType.getMapping(); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity entity = (GenericOrmEntity) entityPersistentType.getMapping(); entity.setSpecifiedAccess(AccessType.PROPERTY); entity.setSpecifiedDiscriminatorValue("DISC_VALUE"); entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED); @@ -861,15 +861,15 @@ public class XmlEntityTests extends ContextModelTestCase entity.setSpecifiedName("ENTITY_NAME"); ormResource().save(null); - entityPersistentType.setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); + entityPersistentType.setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); ormResource().save(null); - Embeddable embeddable = ormResource().getEntityMappings().getEmbeddables().get(0); + XmlEmbeddable embeddable = ormResource().getEntityMappings().getEmbeddables().get(0); assertEquals("model.Foo", embeddable.getClassName()); assertEquals(Boolean.TRUE, embeddable.getMetadataComplete()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, embeddable.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, embeddable.getAccess()); - XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) entityPersistentType.getMapping(); + GenericOrmEmbeddable xmlEmbeddable = (GenericOrmEmbeddable) entityPersistentType.getMapping(); assertEquals("model.Foo", xmlEmbeddable.getClass_()); assertEquals(Boolean.TRUE, xmlEmbeddable.getSpecifiedMetadataComplete()); assertEquals(AccessType.PROPERTY, xmlEmbeddable.getSpecifiedAccess()); @@ -877,9 +877,9 @@ public class XmlEntityTests extends ContextModelTestCase //TODO test that attribute mappings are not removed when changing type mapping. public void testMakeEntityEmbeddable2() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - XmlEntity entity = (XmlEntity) entityPersistentType.getMapping(); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + GenericOrmEntity entity = (GenericOrmEntity) entityPersistentType.getMapping(); entity.setSpecifiedAccess(AccessType.PROPERTY); entity.setSpecifiedDiscriminatorValue("DISC_VALUE"); entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED); @@ -888,16 +888,16 @@ public class XmlEntityTests extends ContextModelTestCase // entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicMapping"); ormResource().save(null); - entityPersistentType.setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); + entityPersistentType.setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); ormResource().save(null); - Embeddable embeddable = ormResource().getEntityMappings().getEmbeddables().get(0); + XmlEmbeddable embeddable = ormResource().getEntityMappings().getEmbeddables().get(0); assertEquals("model.Foo", embeddable.getClassName()); assertEquals(Boolean.TRUE, embeddable.getMetadataComplete()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, embeddable.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, embeddable.getAccess()); // assertEquals("basicMapping", embeddable.getAttributes().getBasics().get(0).getName()); - XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) entityPersistentType.getMapping(); + GenericOrmEmbeddable xmlEmbeddable = (GenericOrmEmbeddable) entityPersistentType.getMapping(); assertEquals("model.Foo", xmlEmbeddable.getClass_()); assertEquals(Boolean.TRUE, xmlEmbeddable.getSpecifiedMetadataComplete()); assertEquals(AccessType.PROPERTY, xmlEmbeddable.getSpecifiedAccess()); @@ -905,8 +905,8 @@ public class XmlEntityTests extends ContextModelTestCase } public void testMakeEntityMappedSuperclass() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity entity = (XmlEntity) entityPersistentType.getMapping(); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity entity = (GenericOrmEntity) entityPersistentType.getMapping(); entity.setSpecifiedAccess(AccessType.PROPERTY); entity.setSpecifiedDiscriminatorValue("DISC_VALUE"); entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED); @@ -914,24 +914,24 @@ public class XmlEntityTests extends ContextModelTestCase entity.setSpecifiedName("ENTITY_NAME"); ormResource().save(null); - entityPersistentType.setMappingKey(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); + entityPersistentType.setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); ormResource().save(null); - MappedSuperclass mappedSuperclass = ormResource().getEntityMappings().getMappedSuperclasses().get(0); + XmlMappedSuperclass mappedSuperclass = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertEquals("model.Foo", mappedSuperclass.getClassName()); assertEquals(Boolean.TRUE, mappedSuperclass.getMetadataComplete()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess()); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) entityPersistentType.getMapping(); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) entityPersistentType.getMapping(); assertEquals("model.Foo", xmlMappedSuperclass.getClass_()); assertEquals(Boolean.TRUE, xmlMappedSuperclass.getSpecifiedMetadataComplete()); assertEquals(AccessType.PROPERTY, xmlMappedSuperclass.getSpecifiedAccess()); } public void testMakeEntityMappedSuperclass2() throws Exception { - entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity entity = (XmlEntity) entityPersistentType.getMapping(); + entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity entity = (GenericOrmEntity) entityPersistentType.getMapping(); entity.setSpecifiedAccess(AccessType.PROPERTY); entity.setSpecifiedDiscriminatorValue("DISC_VALUE"); entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED); @@ -939,15 +939,15 @@ public class XmlEntityTests extends ContextModelTestCase entity.setSpecifiedName("ENTITY_NAME"); ormResource().save(null); - entityPersistentType.setMappingKey(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); + entityPersistentType.setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY); ormResource().save(null); - MappedSuperclass mappedSuperclass = ormResource().getEntityMappings().getMappedSuperclasses().get(0); + XmlMappedSuperclass mappedSuperclass = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertEquals("model.Foo", mappedSuperclass.getClassName()); assertEquals(Boolean.TRUE, mappedSuperclass.getMetadataComplete()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, mappedSuperclass.getAccess()); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) entityPersistentType.getMapping(); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) entityPersistentType.getMapping(); assertEquals("model.Foo", xmlMappedSuperclass.getClass_()); assertEquals(Boolean.TRUE, xmlMappedSuperclass.getSpecifiedMetadataComplete()); assertEquals(AccessType.PROPERTY, xmlMappedSuperclass.getSpecifiedAccess()); @@ -955,9 +955,9 @@ public class XmlEntityTests extends ContextModelTestCase public void testAddSequenceGenerator() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSequenceGenerator()); assertNull(entityResource.getSequenceGenerator()); @@ -977,9 +977,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testRemoveSequenceGenerator() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSequenceGenerator()); assertNull(entityResource.getSequenceGenerator()); @@ -1003,9 +1003,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateSequenceGenerator() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSequenceGenerator()); assertNull(entityResource.getSequenceGenerator()); @@ -1021,9 +1021,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testAddTableGenerator() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getTableGenerator()); assertNull(entityResource.getTableGenerator()); @@ -1043,9 +1043,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testRemoveTableGenerator() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getTableGenerator()); assertNull(entityResource.getTableGenerator()); @@ -1069,9 +1069,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateTableGenerator() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getTableGenerator()); assertNull(entityResource.getTableGenerator()); @@ -1087,9 +1087,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateDiscriminatorColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNotNull(xmlEntity.getDiscriminatorColumn()); @@ -1110,9 +1110,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateDiscriminatorValue() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedDiscriminatorValue()); assertNull(entityResource.getDiscriminatorValue()); @@ -1129,9 +1129,9 @@ public class XmlEntityTests extends ContextModelTestCase } public void testModifyDiscriminatorValue() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getSpecifiedDiscriminatorValue()); assertNull(entityResource.getDiscriminatorValue()); @@ -1148,29 +1148,29 @@ public class XmlEntityTests extends ContextModelTestCase } public void testAddSpecifiedPrimaryKeyJoinColumn() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); - XmlPrimaryKeyJoinColumn primaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); + GenericOrmPrimaryKeyJoinColumn primaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); primaryKeyJoinColumn.setSpecifiedName("FOO"); assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(0).getName()); - XmlPrimaryKeyJoinColumn primaryKeyJoinColumn2 = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); + GenericOrmPrimaryKeyJoinColumn primaryKeyJoinColumn2 = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); primaryKeyJoinColumn2.setSpecifiedName("BAR"); assertEquals("BAR", entityResource.getPrimaryKeyJoinColumns().get(0).getName()); assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(1).getName()); - XmlPrimaryKeyJoinColumn primaryKeyJoinColumn3 = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(1); + GenericOrmPrimaryKeyJoinColumn primaryKeyJoinColumn3 = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(1); primaryKeyJoinColumn3.setSpecifiedName("BAZ"); assertEquals("BAR", entityResource.getPrimaryKeyJoinColumns().get(0).getName()); assertEquals("BAZ", entityResource.getPrimaryKeyJoinColumns().get(1).getName()); assertEquals("FOO", entityResource.getPrimaryKeyJoinColumns().get(2).getName()); - ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns(); + ListIterator<GenericOrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns(); assertEquals(primaryKeyJoinColumn2, primaryKeyJoinColumns.next()); assertEquals(primaryKeyJoinColumn3, primaryKeyJoinColumns.next()); assertEquals(primaryKeyJoinColumn, primaryKeyJoinColumns.next()); @@ -1182,14 +1182,14 @@ public class XmlEntityTests extends ContextModelTestCase } public void testRemoveSpecifiedPrimaryKeyJoinColumn() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO"); xmlEntity.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR"); xmlEntity.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ"); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(3, entityResource.getPrimaryKeyJoinColumns().size()); xmlEntity.removeSpecifiedPrimaryKeyJoinColumn(0); @@ -1206,19 +1206,19 @@ public class XmlEntityTests extends ContextModelTestCase } public void testMoveSpecifiedPrimaryKeyJoinColumn() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO"); xmlEntity.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR"); xmlEntity.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ"); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(3, entityResource.getPrimaryKeyJoinColumns().size()); xmlEntity.moveSpecifiedPrimaryKeyJoinColumn(2, 0); - ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns(); + ListIterator<GenericOrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns(); assertEquals("BAR", primaryKeyJoinColumns.next().getName()); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); @@ -1240,10 +1240,10 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdatePrimaryKeyJoinColumns() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); entityResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn()); entityResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn()); entityResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn()); @@ -1252,7 +1252,7 @@ public class XmlEntityTests extends ContextModelTestCase entityResource.getPrimaryKeyJoinColumns().get(1).setName("BAR"); entityResource.getPrimaryKeyJoinColumns().get(2).setName("BAZ"); - ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns(); + ListIterator<GenericOrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlEntity.specifiedPrimaryKeyJoinColumns(); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); assertEquals("BAR", primaryKeyJoinColumns.next().getName()); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); @@ -1288,29 +1288,29 @@ public class XmlEntityTests extends ContextModelTestCase } public void testAddSpecifiedAttributeOverride() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); - XmlAttributeOverride attributeOverride = xmlEntity.addSpecifiedAttributeOverride(0); + GenericOrmAttributeOverride attributeOverride = xmlEntity.addSpecifiedAttributeOverride(0); attributeOverride.setName("FOO"); assertEquals("FOO", entityResource.getAttributeOverrides().get(0).getName()); - XmlAttributeOverride attributeOverride2 = xmlEntity.addSpecifiedAttributeOverride(0); + GenericOrmAttributeOverride attributeOverride2 = xmlEntity.addSpecifiedAttributeOverride(0); attributeOverride2.setName("BAR"); assertEquals("BAR", entityResource.getAttributeOverrides().get(0).getName()); assertEquals("FOO", entityResource.getAttributeOverrides().get(1).getName()); - XmlAttributeOverride attributeOverride3 = xmlEntity.addSpecifiedAttributeOverride(1); + GenericOrmAttributeOverride attributeOverride3 = xmlEntity.addSpecifiedAttributeOverride(1); attributeOverride3.setName("BAZ"); assertEquals("BAR", entityResource.getAttributeOverrides().get(0).getName()); assertEquals("BAZ", entityResource.getAttributeOverrides().get(1).getName()); assertEquals("FOO", entityResource.getAttributeOverrides().get(2).getName()); - ListIterator<XmlAttributeOverride> attributeOverrides = xmlEntity.specifiedAttributeOverrides(); + ListIterator<GenericOrmAttributeOverride> attributeOverrides = xmlEntity.specifiedAttributeOverrides(); assertEquals(attributeOverride2, attributeOverrides.next()); assertEquals(attributeOverride3, attributeOverrides.next()); assertEquals(attributeOverride, attributeOverrides.next()); @@ -1322,14 +1322,14 @@ public class XmlEntityTests extends ContextModelTestCase } public void testRemoveSpecifiedAttributeOverride() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); xmlEntity.addSpecifiedAttributeOverride(0).setName("FOO"); xmlEntity.addSpecifiedAttributeOverride(1).setName("BAR"); xmlEntity.addSpecifiedAttributeOverride(2).setName("BAZ"); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(3, entityResource.getAttributeOverrides().size()); xmlEntity.removeSpecifiedAttributeOverride(0); @@ -1346,19 +1346,19 @@ public class XmlEntityTests extends ContextModelTestCase } public void testMoveSpecifiedAttributeOverride() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); xmlEntity.addSpecifiedAttributeOverride(0).setName("FOO"); xmlEntity.addSpecifiedAttributeOverride(1).setName("BAR"); xmlEntity.addSpecifiedAttributeOverride(2).setName("BAZ"); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(3, entityResource.getAttributeOverrides().size()); xmlEntity.moveSpecifiedAttributeOverride(2, 0); - ListIterator<XmlAttributeOverride> attributeOverrides = xmlEntity.specifiedAttributeOverrides(); + ListIterator<GenericOrmAttributeOverride> attributeOverrides = xmlEntity.specifiedAttributeOverrides(); assertEquals("BAR", attributeOverrides.next().getName()); assertEquals("BAZ", attributeOverrides.next().getName()); assertEquals("FOO", attributeOverrides.next().getName()); @@ -1380,10 +1380,10 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateAttributeOverrides() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl()); entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl()); entityResource.getAttributeOverrides().add(OrmFactory.eINSTANCE.createAttributeOverrideImpl()); @@ -1392,7 +1392,7 @@ public class XmlEntityTests extends ContextModelTestCase entityResource.getAttributeOverrides().get(1).setName("BAR"); entityResource.getAttributeOverrides().get(2).setName("BAZ"); - ListIterator<XmlAttributeOverride> attributeOverrides = xmlEntity.specifiedAttributeOverrides(); + ListIterator<GenericOrmAttributeOverride> attributeOverrides = xmlEntity.specifiedAttributeOverrides(); assertEquals("FOO", attributeOverrides.next().getName()); assertEquals("BAR", attributeOverrides.next().getName()); assertEquals("BAZ", attributeOverrides.next().getName()); @@ -1428,29 +1428,29 @@ public class XmlEntityTests extends ContextModelTestCase } public void testAddSpecifiedAssociationOverride() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); - XmlAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0); + GenericOrmAssociationOverride associationOverride = xmlEntity.addSpecifiedAssociationOverride(0); associationOverride.setName("FOO"); assertEquals("FOO", entityResource.getAssociationOverrides().get(0).getName()); - XmlAssociationOverride associationOverride2 = xmlEntity.addSpecifiedAssociationOverride(0); + GenericOrmAssociationOverride associationOverride2 = xmlEntity.addSpecifiedAssociationOverride(0); associationOverride2.setName("BAR"); assertEquals("BAR", entityResource.getAssociationOverrides().get(0).getName()); assertEquals("FOO", entityResource.getAssociationOverrides().get(1).getName()); - XmlAssociationOverride associationOverride3 = xmlEntity.addSpecifiedAssociationOverride(1); + GenericOrmAssociationOverride associationOverride3 = xmlEntity.addSpecifiedAssociationOverride(1); associationOverride3.setName("BAZ"); assertEquals("BAR", entityResource.getAssociationOverrides().get(0).getName()); assertEquals("BAZ", entityResource.getAssociationOverrides().get(1).getName()); assertEquals("FOO", entityResource.getAssociationOverrides().get(2).getName()); - ListIterator<XmlAssociationOverride> associationOverrides = xmlEntity.specifiedAssociationOverrides(); + ListIterator<GenericOrmAssociationOverride> associationOverrides = xmlEntity.specifiedAssociationOverrides(); assertEquals(associationOverride2, associationOverrides.next()); assertEquals(associationOverride3, associationOverrides.next()); assertEquals(associationOverride, associationOverrides.next()); @@ -1462,14 +1462,14 @@ public class XmlEntityTests extends ContextModelTestCase } public void testRemoveSpecifiedAssociationOverride() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); xmlEntity.addSpecifiedAssociationOverride(0).setName("FOO"); xmlEntity.addSpecifiedAssociationOverride(1).setName("BAR"); xmlEntity.addSpecifiedAssociationOverride(2).setName("BAZ"); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(3, entityResource.getAssociationOverrides().size()); xmlEntity.removeSpecifiedAssociationOverride(0); @@ -1486,19 +1486,19 @@ public class XmlEntityTests extends ContextModelTestCase } public void testMoveSpecifiedAssociationOverride() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); xmlEntity.addSpecifiedAssociationOverride(0).setName("FOO"); xmlEntity.addSpecifiedAssociationOverride(1).setName("BAR"); xmlEntity.addSpecifiedAssociationOverride(2).setName("BAZ"); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(3, entityResource.getAssociationOverrides().size()); xmlEntity.moveSpecifiedAssociationOverride(2, 0); - ListIterator<XmlAssociationOverride> associationOverrides = xmlEntity.specifiedAssociationOverrides(); + ListIterator<GenericOrmAssociationOverride> associationOverrides = xmlEntity.specifiedAssociationOverrides(); assertEquals("BAR", associationOverrides.next().getName()); assertEquals("BAZ", associationOverrides.next().getName()); assertEquals("FOO", associationOverrides.next().getName()); @@ -1520,10 +1520,10 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateAssociationOverrides() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createAssociationOverride()); entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createAssociationOverride()); entityResource.getAssociationOverrides().add(OrmFactory.eINSTANCE.createAssociationOverride()); @@ -1532,7 +1532,7 @@ public class XmlEntityTests extends ContextModelTestCase entityResource.getAssociationOverrides().get(1).setName("BAR"); entityResource.getAssociationOverrides().get(2).setName("BAZ"); - ListIterator<XmlAssociationOverride> associationOverrides = xmlEntity.specifiedAssociationOverrides(); + ListIterator<GenericOrmAssociationOverride> associationOverrides = xmlEntity.specifiedAssociationOverrides(); assertEquals("FOO", associationOverrides.next().getName()); assertEquals("BAR", associationOverrides.next().getName()); assertEquals("BAZ", associationOverrides.next().getName()); @@ -1569,29 +1569,29 @@ public class XmlEntityTests extends ContextModelTestCase public void testAddNamedQuery() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); - XmlNamedQuery namedQuery = xmlEntity.addNamedQuery(0); + GenericOrmNamedQuery namedQuery = xmlEntity.addNamedQuery(0); namedQuery.setName("FOO"); assertEquals("FOO", entityResource.getNamedQueries().get(0).getName()); - XmlNamedQuery namedQuery2 = xmlEntity.addNamedQuery(0); + GenericOrmNamedQuery namedQuery2 = xmlEntity.addNamedQuery(0); namedQuery2.setName("BAR"); assertEquals("BAR", entityResource.getNamedQueries().get(0).getName()); assertEquals("FOO", entityResource.getNamedQueries().get(1).getName()); - XmlNamedQuery namedQuery3 = xmlEntity.addNamedQuery(1); + GenericOrmNamedQuery namedQuery3 = xmlEntity.addNamedQuery(1); namedQuery3.setName("BAZ"); assertEquals("BAR", entityResource.getNamedQueries().get(0).getName()); assertEquals("BAZ", entityResource.getNamedQueries().get(1).getName()); assertEquals("FOO", entityResource.getNamedQueries().get(2).getName()); - ListIterator<XmlNamedQuery> namedQuerys = xmlEntity.namedQueries(); + ListIterator<GenericOrmNamedQuery> namedQuerys = xmlEntity.namedQueries(); assertEquals(namedQuery2, namedQuerys.next()); assertEquals(namedQuery3, namedQuerys.next()); assertEquals(namedQuery, namedQuerys.next()); @@ -1603,14 +1603,14 @@ public class XmlEntityTests extends ContextModelTestCase } public void testRemoveNamedQuery() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); xmlEntity.addNamedQuery(0).setName("FOO"); xmlEntity.addNamedQuery(1).setName("BAR"); xmlEntity.addNamedQuery(2).setName("BAZ"); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(3, entityResource.getNamedQueries().size()); xmlEntity.removeNamedQuery(0); @@ -1627,19 +1627,19 @@ public class XmlEntityTests extends ContextModelTestCase } public void testMoveNamedQuery() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); xmlEntity.addNamedQuery(0).setName("FOO"); xmlEntity.addNamedQuery(1).setName("BAR"); xmlEntity.addNamedQuery(2).setName("BAZ"); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(3, entityResource.getNamedQueries().size()); xmlEntity.moveNamedQuery(2, 0); - ListIterator<XmlNamedQuery> namedQuerys = xmlEntity.namedQueries(); + ListIterator<GenericOrmNamedQuery> namedQuerys = xmlEntity.namedQueries(); assertEquals("BAR", namedQuerys.next().getName()); assertEquals("BAZ", namedQuerys.next().getName()); assertEquals("FOO", namedQuerys.next().getName()); @@ -1661,10 +1661,10 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateNamedQueries() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); entityResource.getNamedQueries().add(OrmFactory.eINSTANCE.createNamedQuery()); entityResource.getNamedQueries().add(OrmFactory.eINSTANCE.createNamedQuery()); entityResource.getNamedQueries().add(OrmFactory.eINSTANCE.createNamedQuery()); @@ -1673,7 +1673,7 @@ public class XmlEntityTests extends ContextModelTestCase entityResource.getNamedQueries().get(1).setName("BAR"); entityResource.getNamedQueries().get(2).setName("BAZ"); - ListIterator<XmlNamedQuery> namedQuerys = xmlEntity.namedQueries(); + ListIterator<GenericOrmNamedQuery> namedQuerys = xmlEntity.namedQueries(); assertEquals("FOO", namedQuerys.next().getName()); assertEquals("BAR", namedQuerys.next().getName()); assertEquals("BAZ", namedQuerys.next().getName()); @@ -1709,29 +1709,29 @@ public class XmlEntityTests extends ContextModelTestCase } public void testAddNamedNativeQuery() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); - XmlNamedNativeQuery namedNativeQuery = xmlEntity.addNamedNativeQuery(0); + GenericOrmNamedNativeQuery namedNativeQuery = xmlEntity.addNamedNativeQuery(0); namedNativeQuery.setName("FOO"); assertEquals("FOO", entityResource.getNamedNativeQueries().get(0).getName()); - XmlNamedNativeQuery namedNativeQuery2 = xmlEntity.addNamedNativeQuery(0); + GenericOrmNamedNativeQuery namedNativeQuery2 = xmlEntity.addNamedNativeQuery(0); namedNativeQuery2.setName("BAR"); assertEquals("BAR", entityResource.getNamedNativeQueries().get(0).getName()); assertEquals("FOO", entityResource.getNamedNativeQueries().get(1).getName()); - XmlNamedNativeQuery namedNativeQuery3 = xmlEntity.addNamedNativeQuery(1); + GenericOrmNamedNativeQuery namedNativeQuery3 = xmlEntity.addNamedNativeQuery(1); namedNativeQuery3.setName("BAZ"); assertEquals("BAR", entityResource.getNamedNativeQueries().get(0).getName()); assertEquals("BAZ", entityResource.getNamedNativeQueries().get(1).getName()); assertEquals("FOO", entityResource.getNamedNativeQueries().get(2).getName()); - ListIterator<XmlNamedNativeQuery> namedNativeQuerys = xmlEntity.namedNativeQueries(); + ListIterator<GenericOrmNamedNativeQuery> namedNativeQuerys = xmlEntity.namedNativeQueries(); assertEquals(namedNativeQuery2, namedNativeQuerys.next()); assertEquals(namedNativeQuery3, namedNativeQuerys.next()); assertEquals(namedNativeQuery, namedNativeQuerys.next()); @@ -1743,14 +1743,14 @@ public class XmlEntityTests extends ContextModelTestCase } public void testRemoveNamedNativeQuery() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); xmlEntity.addNamedNativeQuery(0).setName("FOO"); xmlEntity.addNamedNativeQuery(1).setName("BAR"); xmlEntity.addNamedNativeQuery(2).setName("BAZ"); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(3, entityResource.getNamedNativeQueries().size()); xmlEntity.removeNamedNativeQuery(0); @@ -1767,19 +1767,19 @@ public class XmlEntityTests extends ContextModelTestCase } public void testMoveNamedNativeQuery() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); xmlEntity.addNamedNativeQuery(0).setName("FOO"); xmlEntity.addNamedNativeQuery(1).setName("BAR"); xmlEntity.addNamedNativeQuery(2).setName("BAZ"); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertEquals(3, entityResource.getNamedNativeQueries().size()); xmlEntity.moveNamedNativeQuery(2, 0); - ListIterator<XmlNamedNativeQuery> namedNativeQuerys = xmlEntity.namedNativeQueries(); + ListIterator<GenericOrmNamedNativeQuery> namedNativeQuerys = xmlEntity.namedNativeQueries(); assertEquals("BAR", namedNativeQuerys.next().getName()); assertEquals("BAZ", namedNativeQuerys.next().getName()); assertEquals("FOO", namedNativeQuerys.next().getName()); @@ -1801,10 +1801,10 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateNamedNativeQueries() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); entityResource.getNamedNativeQueries().add(OrmFactory.eINSTANCE.createNamedNativeQuery()); entityResource.getNamedNativeQueries().add(OrmFactory.eINSTANCE.createNamedNativeQuery()); entityResource.getNamedNativeQueries().add(OrmFactory.eINSTANCE.createNamedNativeQuery()); @@ -1813,7 +1813,7 @@ public class XmlEntityTests extends ContextModelTestCase entityResource.getNamedNativeQueries().get(1).setName("BAR"); entityResource.getNamedNativeQueries().get(2).setName("BAZ"); - ListIterator<XmlNamedNativeQuery> namedNativeQuerys = xmlEntity.namedNativeQueries(); + ListIterator<GenericOrmNamedNativeQuery> namedNativeQuerys = xmlEntity.namedNativeQueries(); assertEquals("FOO", namedNativeQuerys.next().getName()); assertEquals("BAR", namedNativeQuerys.next().getName()); assertEquals("BAZ", namedNativeQuerys.next().getName()); @@ -1849,10 +1849,10 @@ public class XmlEntityTests extends ContextModelTestCase } public void testUpdateIdClass() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getIdClass()); assertNull(entityResource.getIdClass()); @@ -1881,10 +1881,10 @@ public class XmlEntityTests extends ContextModelTestCase } public void testModifyIdClass() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlEntity.getIdClass()); assertNull(entityResource.getIdClass()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlGeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlGeneratedValueTests.java index bb9778689c..6094e9d007 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlGeneratedValueTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlGeneratedValueTests.java @@ -12,17 +12,17 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.XmlGeneratedValue; -import org.eclipse.jpt.core.internal.context.orm.XmlIdMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.GeneratedValue; -import org.eclipse.jpt.core.internal.resource.orm.Id; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmGeneratedValue; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmIdMapping; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlGeneratedValue; +import org.eclipse.jpt.core.resource.orm.XmlId; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -89,12 +89,12 @@ public class XmlGeneratedValueTests extends ContextModelTestCase } public void testUpdateSpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - XmlGeneratedValue xmlGeneratedValue = xmlIdMapping.addGeneratedValue(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); - GeneratedValue generatedValueResource = idResource.getGeneratedValue(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + GenericOrmGeneratedValue xmlGeneratedValue = xmlIdMapping.addGeneratedValue(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + XmlGeneratedValue generatedValueResource = idResource.getGeneratedValue(); //set generator in the resource model, verify context model updated generatedValueResource.setGenerator("FOO"); @@ -108,12 +108,12 @@ public class XmlGeneratedValueTests extends ContextModelTestCase } public void testModifySpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - XmlGeneratedValue xmlGeneratedValue = xmlIdMapping.addGeneratedValue(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); - GeneratedValue generatedValueResource = idResource.getGeneratedValue(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + GenericOrmGeneratedValue xmlGeneratedValue = xmlIdMapping.addGeneratedValue(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + XmlGeneratedValue generatedValueResource = idResource.getGeneratedValue(); //set name in the context model, verify resource model modified xmlGeneratedValue.setSpecifiedGenerator("FOO"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlIdMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlIdMappingTests.java index 17a5c51108..881046d00f 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlIdMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlIdMappingTests.java @@ -12,32 +12,32 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.GenerationType; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.base.TemporalType; -import org.eclipse.jpt.core.internal.context.orm.XmlColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlGeneratedValue; -import org.eclipse.jpt.core.internal.context.orm.XmlIdMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.orm.XmlSequenceGenerator; -import org.eclipse.jpt.core.internal.context.orm.XmlTableGenerator; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.Id; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.GenerationType; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.TemporalType; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmColumn; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmSequenceGenerator; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmTableGenerator; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmGeneratedValue; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmIdMapping; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlId; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -148,10 +148,10 @@ public class XmlIdMappingTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); assertEquals("idMapping", xmlIdMapping.getName()); assertEquals("idMapping", idResource.getName()); @@ -168,10 +168,10 @@ public class XmlIdMappingTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); assertEquals("idMapping", xmlIdMapping.getName()); assertEquals("idMapping", idResource.getName()); @@ -188,30 +188,30 @@ public class XmlIdMappingTests extends ContextModelTestCase } public void testUpdateTemporal() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); ormResource().save(null); assertNull(xmlIdMapping.getTemporal()); assertNull(idResource.getTemporal()); //set temporal in the resource model, verify context model updated - idResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE); + idResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.DATE); ormResource().save(null); assertEquals(TemporalType.DATE, xmlIdMapping.getTemporal()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE, idResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, idResource.getTemporal()); - idResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME); + idResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIME); ormResource().save(null); assertEquals(TemporalType.TIME, xmlIdMapping.getTemporal()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME, idResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, idResource.getTemporal()); - idResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP); + idResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP); ormResource().save(null); assertEquals(TemporalType.TIMESTAMP, xmlIdMapping.getTemporal()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP, idResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, idResource.getTemporal()); //set temporal to null in the resource model idResource.setTemporal(null); @@ -221,10 +221,10 @@ public class XmlIdMappingTests extends ContextModelTestCase } public void testModifyTemporal() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); ormResource().save(null); assertNull(xmlIdMapping.getTemporal()); @@ -233,17 +233,17 @@ public class XmlIdMappingTests extends ContextModelTestCase //set temporal in the context model, verify resource model updated xmlIdMapping.setTemporal(TemporalType.DATE); ormResource().save(null); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE, idResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, idResource.getTemporal()); assertEquals(TemporalType.DATE, xmlIdMapping.getTemporal()); xmlIdMapping.setTemporal(TemporalType.TIME); ormResource().save(null); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME, idResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, idResource.getTemporal()); assertEquals(TemporalType.TIME, xmlIdMapping.getTemporal()); xmlIdMapping.setTemporal(TemporalType.TIMESTAMP); ormResource().save(null); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP, idResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, idResource.getTemporal()); assertEquals(TemporalType.TIMESTAMP, xmlIdMapping.getTemporal()); //set temporal to null in the context model @@ -258,10 +258,10 @@ public class XmlIdMappingTests extends ContextModelTestCase public void testAddSequenceGenerator() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); assertNull(xmlIdMapping.getSequenceGenerator()); assertNull(idResource.getSequenceGenerator()); @@ -281,10 +281,10 @@ public class XmlIdMappingTests extends ContextModelTestCase } public void testRemoveSequenceGenerator() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); assertNull(xmlIdMapping.getSequenceGenerator()); assertNull(idResource.getSequenceGenerator()); @@ -308,10 +308,10 @@ public class XmlIdMappingTests extends ContextModelTestCase } public void testUpdateSequenceGenerator() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); assertNull(xmlIdMapping.getSequenceGenerator()); assertNull(idResource.getSequenceGenerator()); @@ -327,10 +327,10 @@ public class XmlIdMappingTests extends ContextModelTestCase } public void testAddTableGenerator() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); assertNull(xmlIdMapping.getTableGenerator()); assertNull(idResource.getTableGenerator()); @@ -350,10 +350,10 @@ public class XmlIdMappingTests extends ContextModelTestCase } public void testRemoveTableGenerator() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); assertNull(xmlIdMapping.getTableGenerator()); assertNull(idResource.getTableGenerator()); @@ -377,10 +377,10 @@ public class XmlIdMappingTests extends ContextModelTestCase } public void testUpdateTableGenerator() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); assertNull(xmlIdMapping.getTableGenerator()); assertNull(idResource.getTableGenerator()); @@ -396,10 +396,10 @@ public class XmlIdMappingTests extends ContextModelTestCase } public void testAddGeneratedValue() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); assertNull(xmlIdMapping.getGeneratedValue()); assertNull(idResource.getGeneratedValue()); @@ -419,10 +419,10 @@ public class XmlIdMappingTests extends ContextModelTestCase } public void testRemoveGeneratedValue() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); assertNull(xmlIdMapping.getGeneratedValue()); assertNull(idResource.getGeneratedValue()); @@ -446,10 +446,10 @@ public class XmlIdMappingTests extends ContextModelTestCase } public void testUpdateGeneratedValue() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); - Id idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idMapping"); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); + XmlId idResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getIds().get(0); assertNull(xmlIdMapping.getGeneratedValue()); assertNull(idResource.getGeneratedValue()); @@ -468,12 +468,12 @@ public class XmlIdMappingTests extends ContextModelTestCase public void testIdMappingNoUnderylingJavaAttribute() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "foo"); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "foo"); + assertEquals(2, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); assertEquals("foo", xmlIdMapping.getName()); assertNull(xmlIdMapping.getTemporal()); @@ -482,7 +482,7 @@ public class XmlIdMappingTests extends ContextModelTestCase assertNull(xmlIdMapping.getTableGenerator()); - XmlColumn xmlColumn = xmlIdMapping.getColumn(); + GenericOrmColumn xmlColumn = xmlIdMapping.getColumn(); assertNull(xmlColumn.getSpecifiedName()); assertNull(xmlColumn.getSpecifiedUnique()); assertNull(xmlColumn.getSpecifiedNullable()); @@ -515,15 +515,15 @@ public class XmlIdMappingTests extends ContextModelTestCase //@Enumerated(EnumType.STRING) public void testVirtualMappingMetadataCompleteFalse() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + assertEquals(2, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); assertEquals("id", xmlIdMapping.getName()); assertEquals(TemporalType.TIMESTAMP, xmlIdMapping.getTemporal()); - XmlColumn xmlColumn = xmlIdMapping.getColumn(); + GenericOrmColumn xmlColumn = xmlIdMapping.getColumn(); assertEquals("MY_COLUMN", xmlColumn.getSpecifiedName()); assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique()); assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable()); @@ -535,11 +535,11 @@ public class XmlIdMappingTests extends ContextModelTestCase assertEquals(Integer.valueOf(6), xmlColumn.getSpecifiedPrecision()); assertEquals(Integer.valueOf(7), xmlColumn.getSpecifiedScale()); - XmlGeneratedValue xmlGeneratedValue = xmlIdMapping.getGeneratedValue(); + GenericOrmGeneratedValue xmlGeneratedValue = xmlIdMapping.getGeneratedValue(); assertEquals("myTableGenerator", xmlGeneratedValue.getSpecifiedGenerator()); assertEquals(GenerationType.TABLE, xmlGeneratedValue.getSpecifiedStrategy()); - XmlTableGenerator xmlTableGenerator = xmlIdMapping.getTableGenerator(); + GenericOrmTableGenerator xmlTableGenerator = xmlIdMapping.getTableGenerator(); assertEquals("myTableGenerator", xmlTableGenerator.getName()); assertEquals("myTable", xmlTableGenerator.getSpecifiedTable()); assertEquals("myCatalog", xmlTableGenerator.getSpecifiedCatalog()); @@ -550,25 +550,25 @@ public class XmlIdMappingTests extends ContextModelTestCase assertEquals(Integer.valueOf(1), xmlTableGenerator.getSpecifiedInitialValue()); assertEquals(Integer.valueOf(1), xmlTableGenerator.getSpecifiedAllocationSize()); - XmlSequenceGenerator xmlSequenceGenerator = xmlIdMapping.getSequenceGenerator(); + GenericOrmSequenceGenerator xmlSequenceGenerator = xmlIdMapping.getSequenceGenerator(); assertEquals("mySequenceGenerator", xmlSequenceGenerator.getName()); } public void testVirtualMappingMetadataCompleteTrue() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - xmlPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); + assertEquals(2, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); assertEquals("id", xmlIdMapping.getName()); assertNull(xmlIdMapping.getTemporal()); assertNull(xmlIdMapping.getGeneratedValue()); assertNull(xmlIdMapping.getSequenceGenerator()); assertNull(xmlIdMapping.getTableGenerator()); - XmlColumn xmlColumn = xmlIdMapping.getColumn(); + GenericOrmColumn xmlColumn = xmlIdMapping.getColumn(); assertEquals("id", xmlColumn.getSpecifiedName()); assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUnique()); assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedNullable()); @@ -584,12 +584,12 @@ public class XmlIdMappingTests extends ContextModelTestCase public void testSpecifiedMapping() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); - assertEquals(1, xmlPersistentType.virtualAttributesSize()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); + assertEquals(1, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlIdMapping xmlIdMapping = (XmlIdMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmIdMapping xmlIdMapping = (GenericOrmIdMapping) xmlPersistentAttribute.getMapping(); assertEquals("id", xmlIdMapping.getName()); assertNull(xmlIdMapping.getTemporal()); @@ -597,7 +597,7 @@ public class XmlIdMappingTests extends ContextModelTestCase assertNull(xmlIdMapping.getSequenceGenerator()); assertNull(xmlIdMapping.getTableGenerator()); - XmlColumn xmlColumn = xmlIdMapping.getColumn(); + GenericOrmColumn xmlColumn = xmlIdMapping.getColumn(); assertNull(xmlColumn.getSpecifiedName()); assertNull(xmlColumn.getSpecifiedUnique()); assertNull(xmlColumn.getSpecifiedNullable()); @@ -628,163 +628,163 @@ public class XmlIdMappingTests extends ContextModelTestCase public void testIdMorphToBasicMapping() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); - IIdMapping idMapping = (IIdMapping) xmlPersistentAttribute.getMapping(); + IdMapping idMapping = (IdMapping) xmlPersistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); assertFalse(idMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IBasicMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof BasicMapping); assertEquals("id", xmlPersistentAttribute.getMapping().getName()); - assertEquals(TemporalType.TIME, ((IBasicMapping) xmlPersistentAttribute.getMapping()).getTemporal()); - assertEquals("FOO", ((IBasicMapping) xmlPersistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((BasicMapping) xmlPersistentAttribute.getMapping()).getTemporal()); + assertEquals("FOO", ((BasicMapping) xmlPersistentAttribute.getMapping()).getColumn().getSpecifiedName()); } public void testIdMorphToVersionMapping() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); - IIdMapping idMapping = (IIdMapping) xmlPersistentAttribute.getMapping(); + IdMapping idMapping = (IdMapping) xmlPersistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); assertFalse(idMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IVersionMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof VersionMapping); assertEquals("id", xmlPersistentAttribute.getMapping().getName()); - assertEquals(TemporalType.TIME, ((IVersionMapping) xmlPersistentAttribute.getMapping()).getTemporal()); - assertEquals("FOO", ((IVersionMapping) xmlPersistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((VersionMapping) xmlPersistentAttribute.getMapping()).getTemporal()); + assertEquals("FOO", ((VersionMapping) xmlPersistentAttribute.getMapping()).getColumn().getSpecifiedName()); } public void testIdMorphToTransientMapping() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); - IIdMapping idMapping = (IIdMapping) xmlPersistentAttribute.getMapping(); + IdMapping idMapping = (IdMapping) xmlPersistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); assertFalse(idMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertTrue(xmlPersistentAttribute.getMapping() instanceof ITransientMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertTrue(xmlPersistentAttribute.getMapping() instanceof TransientMapping); assertEquals("id", xmlPersistentAttribute.getMapping().getName()); } public void testIdMorphToEmbeddedMapping() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); - IIdMapping idMapping = (IIdMapping) xmlPersistentAttribute.getMapping(); + IdMapping idMapping = (IdMapping) xmlPersistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); assertFalse(idMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedMapping); assertEquals("id", xmlPersistentAttribute.getMapping().getName()); } public void testIdMorphToEmbeddedIdMapping() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); - IIdMapping idMapping = (IIdMapping) xmlPersistentAttribute.getMapping(); + IdMapping idMapping = (IdMapping) xmlPersistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); assertFalse(idMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedIdMapping); assertEquals("id", xmlPersistentAttribute.getMapping().getName()); } public void testIdMorphToOneToOneMapping() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); - IIdMapping idMapping = (IIdMapping) xmlPersistentAttribute.getMapping(); + IdMapping idMapping = (IdMapping) xmlPersistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); assertFalse(idMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToOneMapping); assertEquals("id", xmlPersistentAttribute.getMapping().getName()); } public void testIdMorphToOneToManyMapping() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); - IIdMapping idMapping = (IIdMapping) xmlPersistentAttribute.getMapping(); + IdMapping idMapping = (IdMapping) xmlPersistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); assertFalse(idMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToManyMapping); assertEquals("id", xmlPersistentAttribute.getMapping().getName()); } public void testIdMorphToManyToOneMapping() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); - IIdMapping idMapping = (IIdMapping) xmlPersistentAttribute.getMapping(); + IdMapping idMapping = (IdMapping) xmlPersistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); assertFalse(idMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToOneMapping); assertEquals("id", xmlPersistentAttribute.getMapping().getName()); } public void testIdMorphToManyToManyMapping() throws Exception { createTestEntityIdMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "id"); - IIdMapping idMapping = (IIdMapping) xmlPersistentAttribute.getMapping(); + IdMapping idMapping = (IdMapping) xmlPersistentAttribute.getMapping(); assertFalse(idMapping.isDefault()); idMapping.getColumn().setSpecifiedName("FOO"); idMapping.setTemporal(TemporalType.TIME); assertFalse(idMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToManyMapping); assertEquals("id", xmlPersistentAttribute.getMapping().getName()); } }
\ No newline at end of file diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinColumnTests.java index 7ef1c90c6a..46dbe4c105 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinColumnTests.java @@ -10,18 +10,18 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.orm; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.XmlJoinColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlJoinTable; -import org.eclipse.jpt.core.internal.context.orm.XmlManyToManyMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.orm.JoinColumn; -import org.eclipse.jpt.core.internal.resource.orm.JoinTable; -import org.eclipse.jpt.core.internal.resource.orm.ManyToMany; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmJoinColumn; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmJoinTable; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmManyToManyMapping; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.orm.XmlManyToMany; +import org.eclipse.jpt.core.resource.orm.XmlJoinColumn; +import org.eclipse.jpt.core.resource.orm.XmlJoinTable; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlJoinColumnTests extends ContextModelTestCase @@ -40,15 +40,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(joinColumn.getSpecifiedName()); assertNull(joinColumnResource.getName()); @@ -73,15 +73,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testModifySpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(joinColumn.getSpecifiedName()); assertNull(joinColumnResource.getName()); @@ -98,15 +98,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedReferencedColumnName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(joinColumn.getSpecifiedReferencedColumnName()); assertNull(joinColumnResource.getReferencedColumnName()); @@ -132,15 +132,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testModifySpecifiedReferencedColumnName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(joinColumn.getSpecifiedReferencedColumnName()); assertNull(joinColumnResource.getReferencedColumnName()); @@ -159,8 +159,8 @@ public class XmlJoinColumnTests extends ContextModelTestCase // public void testUpdateDefaultNameFromJavaTable() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName()); // // xmlEntity.javaEntity().getTable().setSpecifiedName("Foo"); @@ -186,8 +186,8 @@ public class XmlJoinColumnTests extends ContextModelTestCase // public void testUpdateDefaultNameNoJava() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertEquals("Foo", xmlEntity.getTable().getDefaultName()); // } // @@ -195,10 +195,10 @@ public class XmlJoinColumnTests extends ContextModelTestCase // createTestEntity(); // createTestSubType(); // -// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); -// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping(); -// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping(); +// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); +// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping(); +// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping(); // // assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName()); // assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName()); @@ -214,15 +214,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase public void testUpdateSpecifiedColumnDefinition() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(joinColumn.getColumnDefinition()); assertNull(joinColumnResource.getColumnDefinition()); @@ -247,15 +247,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testModifySpecifiedColumnDefinition() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(joinColumn.getColumnDefinition()); assertNull(joinColumnResource.getColumnDefinition()); @@ -272,15 +272,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedTable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(xmlJoinColumn.getSpecifiedTable()); assertNull(joinColumnResource.getTable()); @@ -305,15 +305,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testModifySpecifiedTable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(xmlJoinColumn.getSpecifiedTable()); assertNull(joinColumnResource.getTable()); @@ -330,15 +330,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedNullable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(xmlJoinColumn.getSpecifiedNullable()); assertNull(joinColumnResource.getNullable()); @@ -363,15 +363,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testModifySpecifiedNullable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(xmlJoinColumn.getSpecifiedNullable()); assertNull(joinColumnResource.getNullable()); @@ -388,15 +388,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedUpdatable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(xmlJoinColumn.getSpecifiedUpdatable()); assertNull(joinColumnResource.getUpdatable()); @@ -421,15 +421,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testModifySpecifiedUpdatable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(xmlJoinColumn.getSpecifiedUpdatable()); assertNull(joinColumnResource.getUpdatable()); @@ -446,15 +446,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedInsertable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(xmlJoinColumn.getSpecifiedInsertable()); assertNull(joinColumnResource.getInsertable()); @@ -479,15 +479,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testModifySpecifiedInsertable() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(xmlJoinColumn.getSpecifiedInsertable()); assertNull(joinColumnResource.getInsertable()); @@ -504,15 +504,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedUnique() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(xmlJoinColumn.getSpecifiedUnique()); assertNull(joinColumnResource.getUnique()); @@ -537,15 +537,15 @@ public class XmlJoinColumnTests extends ContextModelTestCase } public void testModifySpecifiedUnique() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); - JoinTable joinTableResource = manyToMany.getJoinTable(); - JoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinColumn xmlJoinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinColumn joinColumnResource = joinTableResource.getJoinColumns().get(0); assertNull(xmlJoinColumn.getSpecifiedUnique()); assertNull(joinColumnResource.getUnique()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinTableTests.java index 67d3cb2f2a..e176e914d8 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlJoinTableTests.java @@ -11,18 +11,18 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.ListIterator; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.XmlJoinColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlJoinTable; -import org.eclipse.jpt.core.internal.context.orm.XmlManyToManyMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.orm.JoinTable; -import org.eclipse.jpt.core.internal.resource.orm.ManyToMany; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmJoinColumn; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmJoinTable; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmManyToManyMapping; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.orm.XmlManyToMany; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.orm.XmlJoinTable; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlJoinTableTests extends ContextModelTestCase @@ -41,12 +41,12 @@ public class XmlJoinTableTests extends ContextModelTestCase } public void testUpdateSpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); assertNull(xmlJoinTable.getSpecifiedName()); assertNull(manyToMany.getJoinTable()); @@ -73,12 +73,12 @@ public class XmlJoinTableTests extends ContextModelTestCase } public void testModifySpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); assertNull(xmlJoinTable.getSpecifiedName()); assertNull(manyToMany.getJoinTable()); @@ -97,8 +97,8 @@ public class XmlJoinTableTests extends ContextModelTestCase // public void testUpdateDefaultNameFromJavaTable() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName()); // // xmlEntity.javaEntity().getTable().setSpecifiedName("Foo"); @@ -124,8 +124,8 @@ public class XmlJoinTableTests extends ContextModelTestCase // public void testUpdateDefaultNameNoJava() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertEquals("Foo", xmlEntity.getTable().getDefaultName()); // } // @@ -133,10 +133,10 @@ public class XmlJoinTableTests extends ContextModelTestCase // createTestEntity(); // createTestSubType(); // -// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); -// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping(); -// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping(); +// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); +// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping(); +// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping(); // // assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName()); // assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName()); @@ -151,12 +151,12 @@ public class XmlJoinTableTests extends ContextModelTestCase // } public void testUpdateSpecifiedSchema() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); assertNull(xmlJoinTable.getSpecifiedSchema()); assertNull(manyToMany.getJoinTable()); @@ -184,8 +184,8 @@ public class XmlJoinTableTests extends ContextModelTestCase // public void testUpdateDefaultSchemaFromJavaTable() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertNull(xmlEntity.getTable().getDefaultSchema()); // // xmlEntity.javaEntity().getTable().setSpecifiedSchema("Foo"); @@ -211,8 +211,8 @@ public class XmlJoinTableTests extends ContextModelTestCase // public void testUpdateDefaultSchemaNoJava() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertNull(xmlEntity.getTable().getDefaultSchema()); // } // @@ -220,10 +220,10 @@ public class XmlJoinTableTests extends ContextModelTestCase // createTestEntity(); // createTestSubType(); // -// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); -// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping(); -// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping(); +// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); +// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping(); +// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping(); // // assertNull(parentXmlEntity.getTable().getDefaultSchema()); // assertNull(childXmlEntity.getTable().getDefaultSchema()); @@ -240,8 +240,8 @@ public class XmlJoinTableTests extends ContextModelTestCase // public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertNull(xmlEntity.getTable().getDefaultSchema()); // // xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("FOO"); @@ -269,12 +269,12 @@ public class XmlJoinTableTests extends ContextModelTestCase // } public void testModifySpecifiedSchema() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); assertNull(xmlJoinTable.getSpecifiedSchema()); assertNull(manyToMany.getJoinTable()); @@ -291,12 +291,12 @@ public class XmlJoinTableTests extends ContextModelTestCase } public void testUpdateSpecifiedCatalog() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); assertNull(xmlJoinTable.getSpecifiedCatalog()); assertNull(manyToMany.getJoinTable()); @@ -322,12 +322,12 @@ public class XmlJoinTableTests extends ContextModelTestCase } public void testModifySpecifiedCatalog() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); assertNull(xmlJoinTable.getSpecifiedCatalog()); assertNull(manyToMany.getJoinTable()); @@ -346,8 +346,8 @@ public class XmlJoinTableTests extends ContextModelTestCase // public void testUpdateDefaultCatalogFromJavaTable() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertNull(xmlEntity.getTable().getDefaultCatalog()); // // xmlEntity.javaEntity().getTable().setSpecifiedCatalog("Foo"); @@ -373,8 +373,8 @@ public class XmlJoinTableTests extends ContextModelTestCase // public void testUpdateDefaultCatalogNoJava() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertNull(xmlEntity.getTable().getDefaultCatalog()); // } // @@ -382,10 +382,10 @@ public class XmlJoinTableTests extends ContextModelTestCase // createTestEntity(); // createTestSubType(); // -// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); -// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping(); -// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping(); +// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); +// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping(); +// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping(); // // assertNull(parentXmlEntity.getTable().getDefaultCatalog()); // assertNull(childXmlEntity.getTable().getDefaultCatalog()); @@ -402,8 +402,8 @@ public class XmlJoinTableTests extends ContextModelTestCase // public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertNull(xmlEntity.getTable().getDefaultCatalog()); // // xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("FOO"); @@ -432,8 +432,8 @@ public class XmlJoinTableTests extends ContextModelTestCase // // public void testUpdateName() throws Exception { -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); // assertEquals("Foo", xmlEntity.getName()); // @@ -454,22 +454,22 @@ public class XmlJoinTableTests extends ContextModelTestCase public void testAddSpecifiedJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); + GenericOrmJoinColumn joinColumn = xmlJoinTable.addSpecifiedJoinColumn(0); ormResource().save(null); joinColumn.setSpecifiedName("FOO"); ormResource().save(null); - JoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); assertEquals("FOO", joinTableResource.getJoinColumns().get(0).getName()); - XmlJoinColumn joinColumn2 = xmlJoinTable.addSpecifiedJoinColumn(0); + GenericOrmJoinColumn joinColumn2 = xmlJoinTable.addSpecifiedJoinColumn(0); ormResource().save(null); joinColumn2.setSpecifiedName("BAR"); ormResource().save(null); @@ -477,7 +477,7 @@ public class XmlJoinTableTests extends ContextModelTestCase assertEquals("BAR", joinTableResource.getJoinColumns().get(0).getName()); assertEquals("FOO", joinTableResource.getJoinColumns().get(1).getName()); - XmlJoinColumn joinColumn3 = xmlJoinTable.addSpecifiedJoinColumn(1); + GenericOrmJoinColumn joinColumn3 = xmlJoinTable.addSpecifiedJoinColumn(1); ormResource().save(null); joinColumn3.setSpecifiedName("BAZ"); ormResource().save(null); @@ -486,7 +486,7 @@ public class XmlJoinTableTests extends ContextModelTestCase assertEquals("BAZ", joinTableResource.getJoinColumns().get(1).getName()); assertEquals("FOO", joinTableResource.getJoinColumns().get(2).getName()); - ListIterator<XmlJoinColumn> joinColumns = xmlJoinTable.specifiedJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = xmlJoinTable.specifiedJoinColumns(); assertEquals(joinColumn2, joinColumns.next()); assertEquals(joinColumn3, joinColumns.next()); assertEquals(joinColumn, joinColumns.next()); @@ -498,18 +498,18 @@ public class XmlJoinTableTests extends ContextModelTestCase } public void testRemoveSpecifiedJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); xmlJoinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); xmlJoinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); xmlJoinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ"); - JoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); assertEquals(3, joinTableResource.getJoinColumns().size()); xmlJoinTable.removeSpecifiedJoinColumn(0); @@ -526,23 +526,23 @@ public class XmlJoinTableTests extends ContextModelTestCase } public void testMoveSpecifiedJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); xmlJoinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); xmlJoinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); xmlJoinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ"); - JoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); assertEquals(3, joinTableResource.getJoinColumns().size()); xmlJoinTable.moveSpecifiedJoinColumn(2, 0); - ListIterator<XmlJoinColumn> joinColumns = xmlJoinTable.specifiedJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = xmlJoinTable.specifiedJoinColumns(); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); @@ -564,14 +564,14 @@ public class XmlJoinTableTests extends ContextModelTestCase } public void testUpdateInverseJoinColumns() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); manyToMany.setJoinTable(OrmFactory.eINSTANCE.createJoinTableImpl()); - JoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); joinTableResource.getInverseJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl()); joinTableResource.getInverseJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl()); @@ -581,7 +581,7 @@ public class XmlJoinTableTests extends ContextModelTestCase joinTableResource.getInverseJoinColumns().get(1).setName("BAR"); joinTableResource.getInverseJoinColumns().get(2).setName("BAZ"); - ListIterator<XmlJoinColumn> joinColumns = xmlJoinTable.specifiedInverseJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = xmlJoinTable.specifiedInverseJoinColumns(); assertEquals("FOO", joinColumns.next().getName()); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); @@ -617,22 +617,22 @@ public class XmlJoinTableTests extends ContextModelTestCase } public void testAddSpecifiedInverseJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); - XmlJoinColumn joinColumn = xmlJoinTable.addSpecifiedInverseJoinColumn(0); + GenericOrmJoinColumn joinColumn = xmlJoinTable.addSpecifiedInverseJoinColumn(0); ormResource().save(null); joinColumn.setSpecifiedName("FOO"); ormResource().save(null); - JoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(0).getName()); - XmlJoinColumn joinColumn2 = xmlJoinTable.addSpecifiedInverseJoinColumn(0); + GenericOrmJoinColumn joinColumn2 = xmlJoinTable.addSpecifiedInverseJoinColumn(0); ormResource().save(null); joinColumn2.setSpecifiedName("BAR"); ormResource().save(null); @@ -640,7 +640,7 @@ public class XmlJoinTableTests extends ContextModelTestCase assertEquals("BAR", joinTableResource.getInverseJoinColumns().get(0).getName()); assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(1).getName()); - XmlJoinColumn joinColumn3 = xmlJoinTable.addSpecifiedInverseJoinColumn(1); + GenericOrmJoinColumn joinColumn3 = xmlJoinTable.addSpecifiedInverseJoinColumn(1); ormResource().save(null); joinColumn3.setSpecifiedName("BAZ"); ormResource().save(null); @@ -649,7 +649,7 @@ public class XmlJoinTableTests extends ContextModelTestCase assertEquals("BAZ", joinTableResource.getInverseJoinColumns().get(1).getName()); assertEquals("FOO", joinTableResource.getInverseJoinColumns().get(2).getName()); - ListIterator<XmlJoinColumn> joinColumns = xmlJoinTable.specifiedInverseJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = xmlJoinTable.specifiedInverseJoinColumns(); assertEquals(joinColumn2, joinColumns.next()); assertEquals(joinColumn3, joinColumns.next()); assertEquals(joinColumn, joinColumns.next()); @@ -661,18 +661,18 @@ public class XmlJoinTableTests extends ContextModelTestCase } public void testRemoveSpecifiedInverseJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); xmlJoinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO"); xmlJoinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR"); xmlJoinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ"); - JoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); assertEquals(3, joinTableResource.getInverseJoinColumns().size()); xmlJoinTable.removeSpecifiedInverseJoinColumn(0); @@ -689,23 +689,23 @@ public class XmlJoinTableTests extends ContextModelTestCase } public void testMoveSpecifiedInverseJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); xmlJoinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO"); xmlJoinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR"); xmlJoinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ"); - JoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); assertEquals(3, joinTableResource.getInverseJoinColumns().size()); xmlJoinTable.moveSpecifiedInverseJoinColumn(2, 0); - ListIterator<XmlJoinColumn> joinColumns = xmlJoinTable.specifiedInverseJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = xmlJoinTable.specifiedInverseJoinColumns(); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); @@ -727,14 +727,14 @@ public class XmlJoinTableTests extends ContextModelTestCase } public void testUpdateJoinColumns() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); - XmlJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); + GenericOrmJoinTable xmlJoinTable = xmlManyToManyMapping.getJoinTable(); manyToMany.setJoinTable(OrmFactory.eINSTANCE.createJoinTableImpl()); - JoinTable joinTableResource = manyToMany.getJoinTable(); + XmlJoinTable joinTableResource = manyToMany.getJoinTable(); joinTableResource.getJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl()); joinTableResource.getJoinColumns().add(OrmFactory.eINSTANCE.createJoinColumnImpl()); @@ -744,7 +744,7 @@ public class XmlJoinTableTests extends ContextModelTestCase joinTableResource.getJoinColumns().get(1).setName("BAR"); joinTableResource.getJoinColumns().get(2).setName("BAZ"); - ListIterator<XmlJoinColumn> joinColumns = xmlJoinTable.specifiedJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = xmlJoinTable.specifiedJoinColumns(); assertEquals("FOO", joinColumns.next().getName()); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToManyMappingTests.java index 6054fca451..e4aba7251f 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToManyMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToManyMappingTests.java @@ -10,28 +10,28 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.orm; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.FetchType; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IJoinColumn; -import org.eclipse.jpt.core.internal.context.base.IJoinTable; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlManyToManyMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.orm.ManyToMany; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.FetchType; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.JoinColumn; +import org.eclipse.jpt.core.context.JoinTable; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmManyToManyMapping; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.orm.XmlManyToMany; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlManyToManyMappingTests extends ContextModelTestCase @@ -51,10 +51,10 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); assertEquals("manyToManyMapping", xmlManyToManyMapping.getName()); assertEquals("manyToManyMapping", manyToMany.getName()); @@ -71,10 +71,10 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); assertEquals("manyToManyMapping", xmlManyToManyMapping.getName()); assertEquals("manyToManyMapping", manyToMany.getName()); @@ -91,10 +91,10 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testUpdateTargetEntity() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); assertNull(xmlManyToManyMapping.getSpecifiedTargetEntity()); assertNull(manyToMany.getTargetEntity()); @@ -111,10 +111,10 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testModifyTargetEntity() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); assertNull(xmlManyToManyMapping.getSpecifiedTargetEntity()); assertNull(manyToMany.getTargetEntity()); @@ -131,22 +131,22 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testUpdateSpecifiedFetch() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToManyResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToManyResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); assertNull(xmlManyToManyMapping.getSpecifiedFetch()); assertNull(manyToManyResource.getFetch()); //set fetch in the resource model, verify context model updated - manyToManyResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER); + manyToManyResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.EAGER); assertEquals(FetchType.EAGER, xmlManyToManyMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, manyToManyResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, manyToManyResource.getFetch()); - manyToManyResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY); + manyToManyResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.LAZY); assertEquals(FetchType.LAZY, xmlManyToManyMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, manyToManyResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, manyToManyResource.getFetch()); //set fetch to null in the resource model manyToManyResource.setFetch(null); @@ -155,21 +155,21 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testModifySpecifiedFetch() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToManyResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToManyResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); assertNull(xmlManyToManyMapping.getSpecifiedFetch()); assertNull(manyToManyResource.getFetch()); //set fetch in the context model, verify resource model updated xmlManyToManyMapping.setSpecifiedFetch(FetchType.EAGER); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, manyToManyResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, manyToManyResource.getFetch()); assertEquals(FetchType.EAGER, xmlManyToManyMapping.getSpecifiedFetch()); xmlManyToManyMapping.setSpecifiedFetch(FetchType.LAZY); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, manyToManyResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, manyToManyResource.getFetch()); assertEquals(FetchType.LAZY, xmlManyToManyMapping.getSpecifiedFetch()); //set fetch to null in the context model @@ -179,10 +179,10 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testUpdateMappedBy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); assertNull(xmlManyToManyMapping.getMappedBy()); assertNull(manyToMany.getMappedBy()); @@ -199,10 +199,10 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testModifyMappedBy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); assertNull(xmlManyToManyMapping.getMappedBy()); assertNull(manyToMany.getMappedBy()); @@ -219,10 +219,10 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testUpdateMapKey() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); assertNull(xmlManyToManyMapping.getMapKey()); assertNull(manyToMany.getMapKey()); @@ -249,10 +249,10 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testModifyMapKey() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); assertNull(xmlManyToManyMapping.getMapKey()); assertNull(manyToMany.getMapKey()); @@ -269,10 +269,10 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testUpdateOrderBy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); assertNull(xmlManyToManyMapping.getOrderBy()); assertNull(manyToMany.getOrderBy()); @@ -289,10 +289,10 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testModifyOrderBy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); - ManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); + XmlManyToMany manyToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToManys().get(0); assertNull(xmlManyToManyMapping.getOrderBy()); assertNull(manyToMany.getOrderBy()); @@ -309,9 +309,9 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testIsNoOrdering() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); assertTrue(xmlManyToManyMapping.isNoOrdering()); @@ -323,9 +323,9 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testSetNoOrdering() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); assertTrue(xmlManyToManyMapping.isNoOrdering()); @@ -346,9 +346,9 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase // } public void testIsCustomOrdering() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); - XmlManyToManyMapping xmlManyToManyMapping = (XmlManyToManyMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToManyMapping"); + GenericOrmManyToManyMapping xmlManyToManyMapping = (GenericOrmManyToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(xmlManyToManyMapping.isCustomOrdering()); @@ -360,10 +360,10 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testManyToManyMorphToIdMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) xmlPersistentAttribute.getMapping(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(manyToManyMapping.isDefault()); manyToManyMapping.setSpecifiedFetch(FetchType.EAGER); manyToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -371,26 +371,26 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase manyToManyMapping.setMapKey("mapKey"); manyToManyMapping.setMappedBy("mappedBy"); manyToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(manyToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof IdMapping); assertEquals("manyToMany", xmlPersistentAttribute.getMapping().getName()); } public void testManyToManyMorphToVersionMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) xmlPersistentAttribute.getMapping(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(manyToManyMapping.isDefault()); manyToManyMapping.setSpecifiedFetch(FetchType.EAGER); manyToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -398,26 +398,26 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase manyToManyMapping.setMapKey("mapKey"); manyToManyMapping.setMappedBy("mappedBy"); manyToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(manyToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IVersionMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof VersionMapping); assertEquals("manyToMany", xmlPersistentAttribute.getMapping().getName()); } public void testManyToManyMorphToTransientMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) xmlPersistentAttribute.getMapping(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(manyToManyMapping.isDefault()); manyToManyMapping.setSpecifiedFetch(FetchType.EAGER); manyToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -425,26 +425,26 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase manyToManyMapping.setMapKey("mapKey"); manyToManyMapping.setMappedBy("mappedBy"); manyToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(manyToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof ITransientMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof TransientMapping); assertEquals("manyToMany", xmlPersistentAttribute.getMapping().getName()); } public void testManyToManyMorphToEmbeddedMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) xmlPersistentAttribute.getMapping(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(manyToManyMapping.isDefault()); manyToManyMapping.setSpecifiedFetch(FetchType.EAGER); manyToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -452,26 +452,26 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase manyToManyMapping.setMapKey("mapKey"); manyToManyMapping.setMappedBy("mappedBy"); manyToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(manyToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedMapping); assertEquals("manyToMany", xmlPersistentAttribute.getMapping().getName()); } public void testManyToManyMorphToEmbeddedIdMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) xmlPersistentAttribute.getMapping(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(manyToManyMapping.isDefault()); manyToManyMapping.setSpecifiedFetch(FetchType.EAGER); manyToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -479,26 +479,26 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase manyToManyMapping.setMapKey("mapKey"); manyToManyMapping.setMappedBy("mappedBy"); manyToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(manyToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedIdMapping); assertEquals("manyToMany", xmlPersistentAttribute.getMapping().getName()); } public void testManyToManyMorphToOneToOneMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) xmlPersistentAttribute.getMapping(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(manyToManyMapping.isDefault()); manyToManyMapping.setSpecifiedFetch(FetchType.EAGER); manyToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -511,34 +511,34 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase manyToManyMapping.getCascade().setRefresh(true); manyToManyMapping.getCascade().setRemove(true); manyToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(manyToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToOneMapping); assertEquals("manyToMany", xmlPersistentAttribute.getMapping().getName()); - assertEquals(FetchType.EAGER, ((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); - assertEquals("TargetEntity", ((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); - assertEquals("mappedBy", ((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getMappedBy()); - assertTrue(((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); - assertTrue(((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); - assertTrue(((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); - assertTrue(((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); - assertTrue(((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); + assertEquals(FetchType.EAGER, ((OneToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); + assertEquals("TargetEntity", ((OneToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); + assertEquals("mappedBy", ((OneToOneMapping) xmlPersistentAttribute.getMapping()).getMappedBy()); + assertTrue(((OneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); + assertTrue(((OneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); + assertTrue(((OneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); + assertTrue(((OneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); + assertTrue(((OneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); } public void testManyToManyMorphToOneToManyMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) xmlPersistentAttribute.getMapping(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(manyToManyMapping.isDefault()); manyToManyMapping.setSpecifiedFetch(FetchType.EAGER); manyToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -551,28 +551,28 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase manyToManyMapping.getCascade().setRefresh(true); manyToManyMapping.getCascade().setRemove(true); manyToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(manyToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToManyMapping); assertEquals("manyToMany", xmlPersistentAttribute.getMapping().getName()); - assertEquals(FetchType.EAGER, ((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); - assertEquals("TargetEntity", ((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); - assertEquals("mappedBy", ((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getMappedBy()); - assertTrue(((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); - assertTrue(((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); - assertTrue(((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); - assertTrue(((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); - assertTrue(((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); - IJoinTable joinTable = ((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getJoinTable(); + assertEquals(FetchType.EAGER, ((OneToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); + assertEquals("TargetEntity", ((OneToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); + assertEquals("mappedBy", ((OneToManyMapping) xmlPersistentAttribute.getMapping()).getMappedBy()); + assertTrue(((OneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); + assertTrue(((OneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); + assertTrue(((OneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); + assertTrue(((OneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); + assertTrue(((OneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); + JoinTable joinTable = ((OneToManyMapping) xmlPersistentAttribute.getMapping()).getJoinTable(); assertEquals("MY_JOIN_TABLE", joinTable.getName()); assertEquals("name", joinTable.joinColumns().next().getSpecifiedName()); assertEquals("referenceName", joinTable.joinColumns().next().getSpecifiedReferencedColumnName()); @@ -581,10 +581,10 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase } public void testManyToManyMorphToManyToOneMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) xmlPersistentAttribute.getMapping(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(manyToManyMapping.isDefault()); manyToManyMapping.setSpecifiedFetch(FetchType.EAGER); manyToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -597,33 +597,33 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase manyToManyMapping.getCascade().setRefresh(true); manyToManyMapping.getCascade().setRemove(true); manyToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(manyToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToOneMapping); assertEquals("manyToMany", xmlPersistentAttribute.getMapping().getName()); - assertEquals(FetchType.EAGER, ((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); - assertEquals("TargetEntity", ((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); + assertEquals(FetchType.EAGER, ((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); + assertEquals("TargetEntity", ((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); } public void testManyToManyMorphToBasicMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, "manyToMany"); - IManyToManyMapping manyToManyMapping = (IManyToManyMapping) xmlPersistentAttribute.getMapping(); + ManyToManyMapping manyToManyMapping = (ManyToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(manyToManyMapping.isDefault()); manyToManyMapping.setSpecifiedFetch(FetchType.EAGER); manyToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -636,18 +636,18 @@ public class XmlManyToManyMappingTests extends ContextModelTestCase manyToManyMapping.getCascade().setRefresh(true); manyToManyMapping.getCascade().setRemove(true); manyToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = manyToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = manyToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(manyToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IBasicMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof BasicMapping); assertEquals("manyToMany", xmlPersistentAttribute.getMapping().getName()); //TODO assertEquals(FetchType.EAGER, ((IBasicMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToOneMappingTests.java index b3a3452bdc..a6da528e7d 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToOneMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlManyToOneMappingTests.java @@ -13,18 +13,18 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.FetchType; -import org.eclipse.jpt.core.internal.context.orm.XmlCascade; -import org.eclipse.jpt.core.internal.context.orm.XmlJoinColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlManyToOneMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.ManyToOne; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.FetchType; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmJoinColumn; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmManyToOneMapping; +import org.eclipse.jpt.core.internal.context.orm.OrmCascade; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlManyToOne; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -130,10 +130,10 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); - ManyToOne manyToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); + XmlManyToOne manyToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); assertEquals("manyToOneMapping", xmlManyToOneMapping.getName()); assertEquals("manyToOneMapping", manyToOne.getName()); @@ -150,10 +150,10 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); - ManyToOne manyToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); + XmlManyToOne manyToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); assertEquals("manyToOneMapping", xmlManyToOneMapping.getName()); assertEquals("manyToOneMapping", manyToOne.getName()); @@ -170,10 +170,10 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase } public void testUpdateTargetEntity() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); - ManyToOne manyToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); + XmlManyToOne manyToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); assertNull(xmlManyToOneMapping.getSpecifiedTargetEntity()); assertNull(manyToOne.getTargetEntity()); @@ -190,10 +190,10 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase } public void testModifyTargetEntity() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); - ManyToOne manyToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); + XmlManyToOne manyToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); assertNull(xmlManyToOneMapping.getSpecifiedTargetEntity()); assertNull(manyToOne.getTargetEntity()); @@ -210,22 +210,22 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase } public void testUpdateSpecifiedFetch() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); - ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); + XmlManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); assertNull(xmlManyToOneMapping.getSpecifiedFetch()); assertNull(manyToOneResource.getFetch()); //set fetch in the resource model, verify context model updated - manyToOneResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER); + manyToOneResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.EAGER); assertEquals(FetchType.EAGER, xmlManyToOneMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, manyToOneResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, manyToOneResource.getFetch()); - manyToOneResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY); + manyToOneResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.LAZY); assertEquals(FetchType.LAZY, xmlManyToOneMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, manyToOneResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, manyToOneResource.getFetch()); //set fetch to null in the resource model manyToOneResource.setFetch(null); @@ -234,21 +234,21 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase } public void testModifySpecifiedFetch() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); - ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); + XmlManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); assertNull(xmlManyToOneMapping.getSpecifiedFetch()); assertNull(manyToOneResource.getFetch()); //set fetch in the context model, verify resource model updated xmlManyToOneMapping.setSpecifiedFetch(FetchType.EAGER); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, manyToOneResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, manyToOneResource.getFetch()); assertEquals(FetchType.EAGER, xmlManyToOneMapping.getSpecifiedFetch()); xmlManyToOneMapping.setSpecifiedFetch(FetchType.LAZY); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, manyToOneResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, manyToOneResource.getFetch()); assertEquals(FetchType.LAZY, xmlManyToOneMapping.getSpecifiedFetch()); //set fetch to null in the context model @@ -258,10 +258,10 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase } public void testUpdateSpecifiedOptional() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); - ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); + XmlManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); assertNull(xmlManyToOneMapping.getSpecifiedOptional()); assertNull(manyToOneResource.getOptional()); @@ -282,10 +282,10 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase } public void testModifySpecifiedOptional() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); - ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); + XmlManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); assertNull(xmlManyToOneMapping.getSpecifiedOptional()); assertNull(manyToOneResource.getOptional()); @@ -306,19 +306,19 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase } public void testAddSpecifiedJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); - ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); + XmlManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); - XmlJoinColumn joinColumn = xmlManyToOneMapping.addSpecifiedJoinColumn(0); + GenericOrmJoinColumn joinColumn = xmlManyToOneMapping.addSpecifiedJoinColumn(0); ormResource().save(null); joinColumn.setSpecifiedName("FOO"); ormResource().save(null); assertEquals("FOO", manyToOneResource.getJoinColumns().get(0).getName()); - XmlJoinColumn joinColumn2 = xmlManyToOneMapping.addSpecifiedJoinColumn(0); + GenericOrmJoinColumn joinColumn2 = xmlManyToOneMapping.addSpecifiedJoinColumn(0); ormResource().save(null); joinColumn2.setSpecifiedName("BAR"); ormResource().save(null); @@ -326,7 +326,7 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase assertEquals("BAR", manyToOneResource.getJoinColumns().get(0).getName()); assertEquals("FOO", manyToOneResource.getJoinColumns().get(1).getName()); - XmlJoinColumn joinColumn3 = xmlManyToOneMapping.addSpecifiedJoinColumn(1); + GenericOrmJoinColumn joinColumn3 = xmlManyToOneMapping.addSpecifiedJoinColumn(1); ormResource().save(null); joinColumn3.setSpecifiedName("BAZ"); ormResource().save(null); @@ -335,7 +335,7 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase assertEquals("BAZ", manyToOneResource.getJoinColumns().get(1).getName()); assertEquals("FOO", manyToOneResource.getJoinColumns().get(2).getName()); - ListIterator<XmlJoinColumn> joinColumns = xmlManyToOneMapping.specifiedJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = xmlManyToOneMapping.specifiedJoinColumns(); assertEquals(joinColumn2, joinColumns.next()); assertEquals(joinColumn3, joinColumns.next()); assertEquals(joinColumn, joinColumns.next()); @@ -347,10 +347,10 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase } public void testRemoveSpecifiedJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); - ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); + XmlManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); xmlManyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); xmlManyToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); @@ -372,10 +372,10 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase } public void testMoveSpecifiedJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); - ManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "manyToOneMapping"); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); + XmlManyToOne manyToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getManyToOnes().get(0); xmlManyToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); xmlManyToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); @@ -385,7 +385,7 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase xmlManyToOneMapping.moveSpecifiedJoinColumn(2, 0); - ListIterator<XmlJoinColumn> joinColumns = xmlManyToOneMapping.specifiedJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = xmlManyToOneMapping.specifiedJoinColumns(); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); @@ -411,13 +411,13 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase createTestEntityManyToOneMapping(); createTestTargetEntityAddress(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "foo"); - assertEquals(3, xmlPersistentType.virtualAttributesSize()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "foo"); + assertEquals(3, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); assertEquals("foo", xmlManyToOneMapping.getName()); @@ -434,7 +434,7 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase //assertTrue(xmlManyToOneMapping.defaultJoinColumns().hasNext()); - XmlCascade xmlCascade = xmlManyToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlManyToOneMapping.getCascade(); assertFalse(xmlCascade.isAll()); assertFalse(xmlCascade.isMerge()); assertFalse(xmlCascade.isPersist()); @@ -446,18 +446,18 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase createTestEntityManyToOneMapping(); createTestTargetEntityAddress(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); - assertEquals(3, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); + assertEquals(3, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); assertEquals("address", xmlManyToOneMapping.getName()); assertEquals(FetchType.LAZY, xmlManyToOneMapping.getSpecifiedFetch()); assertEquals(Boolean.FALSE, xmlManyToOneMapping.getSpecifiedOptional()); assertEquals("Address", xmlManyToOneMapping.getSpecifiedTargetEntity()); - XmlJoinColumn xmlJoinColumn = xmlManyToOneMapping.specifiedJoinColumns().next(); + GenericOrmJoinColumn xmlJoinColumn = xmlManyToOneMapping.specifiedJoinColumns().next(); assertEquals("MY_COLUMN", xmlJoinColumn.getSpecifiedName()); assertEquals("MY_REFERENCED_COLUMN", xmlJoinColumn.getSpecifiedReferencedColumnName()); assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedUnique()); @@ -467,7 +467,7 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase assertEquals("COLUMN_DEFINITION", xmlJoinColumn.getColumnDefinition()); assertEquals("MY_TABLE", xmlJoinColumn.getSpecifiedTable()); - XmlCascade xmlCascade = xmlManyToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlManyToOneMapping.getCascade(); assertTrue(xmlCascade.isAll()); assertTrue(xmlCascade.isMerge()); assertTrue(xmlCascade.isPersist()); @@ -479,13 +479,13 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase createTestEntityManyToOneMapping(); createTestTargetEntityAddress(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); - xmlPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); - assertEquals(3, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); + ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); + assertEquals(3, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); assertEquals("address", xmlManyToOneMapping.getName()); assertEquals(FetchType.EAGER, xmlManyToOneMapping.getSpecifiedFetch()); assertEquals(Boolean.TRUE, xmlManyToOneMapping.getSpecifiedOptional()); @@ -504,7 +504,7 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase // assertNull(xmlJoinColumn.getColumnDefinition()); // assertEquals(TYPE_NAME, xmlJoinColumn.getSpecifiedTable()); - XmlCascade xmlCascade = xmlManyToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlManyToOneMapping.getCascade(); assertFalse(xmlCascade.isAll()); assertFalse(xmlCascade.isMerge()); assertFalse(xmlCascade.isPersist()); @@ -516,14 +516,14 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase createTestEntityManyToOneMapping(); createTestTargetEntityAddress(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address"); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address"); + assertEquals(2, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlManyToOneMapping xmlManyToOneMapping = (XmlManyToOneMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmManyToOneMapping xmlManyToOneMapping = (GenericOrmManyToOneMapping) xmlPersistentAttribute.getMapping(); assertEquals("address", xmlManyToOneMapping.getName()); assertNull(xmlManyToOneMapping.getSpecifiedFetch()); @@ -556,7 +556,7 @@ public class XmlManyToOneMappingTests extends ContextModelTestCase // assertEquals(null, xmlJoinColumn.getColumnDefinition()); // assertEquals(TYPE_NAME, xmlJoinColumn.getDefaultTable()); - XmlCascade xmlCascade = xmlManyToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlManyToOneMapping.getCascade(); assertFalse(xmlCascade.isAll()); assertFalse(xmlCascade.isMerge()); assertFalse(xmlCascade.isPersist()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlMappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlMappedSuperclassTests.java index 66d5b69558..f2e6e667a4 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlMappedSuperclassTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlMappedSuperclassTests.java @@ -11,19 +11,19 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.ListIterator; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.AccessType; -import org.eclipse.jpt.core.internal.context.orm.XmlEmbeddable; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlMappedSuperclass; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.orm.Embeddable; -import org.eclipse.jpt.core.internal.resource.orm.Entity; -import org.eclipse.jpt.core.internal.resource.orm.MappedSuperclass; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.AccessType; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEmbeddable; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmMappedSuperclass; +import org.eclipse.jpt.core.resource.orm.XmlEmbeddable; +import org.eclipse.jpt.core.resource.orm.XmlEntity; +import org.eclipse.jpt.core.resource.orm.XmlMappedSuperclass; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlMappedSuperclassTests extends ContextModelTestCase @@ -43,9 +43,9 @@ public class XmlMappedSuperclassTests extends ContextModelTestCase } public void testUpdateClass() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping(); - MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) ormPersistentType.getMapping(); + XmlMappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertEquals("model.Foo", xmlMappedSuperclass.getClass_()); assertEquals("model.Foo", mappedSuperclassResource.getClassName()); @@ -62,9 +62,9 @@ public class XmlMappedSuperclassTests extends ContextModelTestCase } public void testModifyClass() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping(); - MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) ormPersistentType.getMapping(); + XmlMappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertEquals("model.Foo", xmlMappedSuperclass.getClass_()); assertEquals("model.Foo", mappedSuperclassResource.getClassName()); @@ -81,16 +81,16 @@ public class XmlMappedSuperclassTests extends ContextModelTestCase //TODO add tests for setting the className when the package is set on entity-mappings public void testUpdateSpecifiedAccess() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping(); - MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) ormPersistentType.getMapping(); + XmlMappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedAccess()); assertNull(mappedSuperclassResource.getAccess()); //set access in the resource model, verify context model updated - mappedSuperclassResource.setAccess(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD); + mappedSuperclassResource.setAccess(org.eclipse.jpt.core.resource.orm.AccessType.FIELD); assertEquals(AccessType.FIELD, xmlMappedSuperclass.getSpecifiedAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.FIELD, mappedSuperclassResource.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.FIELD, mappedSuperclassResource.getAccess()); //set access to null in the resource model mappedSuperclassResource.setAccess(null); @@ -99,16 +99,16 @@ public class XmlMappedSuperclassTests extends ContextModelTestCase } public void testModifySpecifiedAccess() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping(); - MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) ormPersistentType.getMapping(); + XmlMappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedAccess()); assertNull(mappedSuperclassResource.getAccess()); //set access in the context model, verify resource model modified xmlMappedSuperclass.setSpecifiedAccess(AccessType.PROPERTY); assertEquals(AccessType.PROPERTY, xmlMappedSuperclass.getSpecifiedAccess()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, mappedSuperclassResource.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, mappedSuperclassResource.getAccess()); //set access to null in the context model xmlMappedSuperclass.setSpecifiedAccess(null); @@ -122,9 +122,9 @@ public class XmlMappedSuperclassTests extends ContextModelTestCase //with xml-mapping-metadata-complete set public void testUpdateSpecifiedMetadataComplete() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping(); - MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) ormPersistentType.getMapping(); + XmlMappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete()); assertNull(mappedSuperclassResource.getMetadataComplete()); @@ -144,9 +144,9 @@ public class XmlMappedSuperclassTests extends ContextModelTestCase } public void testModifySpecifiedMetadataComplete() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping(); - MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) ormPersistentType.getMapping(); + XmlMappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete()); assertNull(mappedSuperclassResource.getMetadataComplete()); //set access in the context model, verify resource model modified @@ -165,9 +165,9 @@ public class XmlMappedSuperclassTests extends ContextModelTestCase } public void testUpdateDefaultMetadataComplete() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping(); - MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) ormPersistentType.getMapping(); + XmlMappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete()); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete()); assertFalse(xmlMappedSuperclass.isDefaultMetadataComplete()); @@ -186,9 +186,9 @@ public class XmlMappedSuperclassTests extends ContextModelTestCase } public void testUpdateMetadataComplete() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping(); - MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) ormPersistentType.getMapping(); + XmlMappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete()); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete()); assertFalse(xmlMappedSuperclass.isMetadataComplete()); @@ -208,23 +208,23 @@ public class XmlMappedSuperclassTests extends ContextModelTestCase public void testMakeMappedSuperclassEntity() throws Exception { - XmlPersistentType mappedSuperclassPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - XmlMappedSuperclass mappedSuperclass = (XmlMappedSuperclass) mappedSuperclassPersistentType.getMapping(); + OrmPersistentType mappedSuperclassPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmMappedSuperclass mappedSuperclass = (GenericOrmMappedSuperclass) mappedSuperclassPersistentType.getMapping(); mappedSuperclass.setSpecifiedAccess(AccessType.PROPERTY); mappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE); ormResource().save(null); - mappedSuperclassPersistentType.setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY); + mappedSuperclassPersistentType.setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY); ormResource().save(null); - Entity entity = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entity = ormResource().getEntityMappings().getEntities().get(0); assertEquals("model.Foo", entity.getClassName()); assertEquals(Boolean.TRUE, entity.getMetadataComplete()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, entity.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, entity.getAccess()); assertNull(entity.getDiscriminatorValue()); assertNull(entity.getName()); - XmlEntity xmlEntity = (XmlEntity) mappedSuperclassPersistentType.getMapping(); + GenericOrmEntity xmlEntity = (GenericOrmEntity) mappedSuperclassPersistentType.getMapping(); assertEquals("model.Foo", xmlEntity.getClass_()); assertEquals(Boolean.TRUE, xmlEntity.getSpecifiedMetadataComplete()); assertEquals(AccessType.PROPERTY, xmlEntity.getSpecifiedAccess()); @@ -232,84 +232,84 @@ public class XmlMappedSuperclassTests extends ContextModelTestCase //test with 2 MappedSuperclasses, make the first one an Entity so it has to move to the end of the list public void testMakeMappedSuperclassEntity2() throws Exception { - XmlPersistentType mappedSuperclassPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo2"); - XmlMappedSuperclass mappedSuperclass = (XmlMappedSuperclass) mappedSuperclassPersistentType.getMapping(); + OrmPersistentType mappedSuperclassPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo2"); + GenericOrmMappedSuperclass mappedSuperclass = (GenericOrmMappedSuperclass) mappedSuperclassPersistentType.getMapping(); mappedSuperclass.setSpecifiedAccess(AccessType.PROPERTY); mappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE); ormResource().save(null); - mappedSuperclassPersistentType.setMappingKey(IMappingKeys.ENTITY_TYPE_MAPPING_KEY); + mappedSuperclassPersistentType.setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY); ormResource().save(null); - Entity entity = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entity = ormResource().getEntityMappings().getEntities().get(0); assertEquals("model.Foo", entity.getClassName()); assertEquals(Boolean.TRUE, entity.getMetadataComplete()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, entity.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, entity.getAccess()); assertNull(entity.getDiscriminatorValue()); assertNull(entity.getName()); - XmlEntity xmlEntity = (XmlEntity) mappedSuperclassPersistentType.getMapping(); + GenericOrmEntity xmlEntity = (GenericOrmEntity) mappedSuperclassPersistentType.getMapping(); assertEquals("model.Foo", xmlEntity.getClass_()); assertEquals(Boolean.TRUE, xmlEntity.getSpecifiedMetadataComplete()); assertEquals(AccessType.PROPERTY, xmlEntity.getSpecifiedAccess()); - ListIterator<XmlPersistentType> persistentTypes = entityMappings().xmlPersistentTypes(); - assertEquals(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); - assertEquals(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); + ListIterator<OrmPersistentType> persistentTypes = entityMappings().ormPersistentTypes(); + assertEquals(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); + assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); } public void testMakeMappedSuperclassEmbeddable() throws Exception { - XmlPersistentType mappedSuperclassPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - XmlMappedSuperclass mappedSuperclass = (XmlMappedSuperclass) mappedSuperclassPersistentType.getMapping(); + OrmPersistentType mappedSuperclassPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmMappedSuperclass mappedSuperclass = (GenericOrmMappedSuperclass) mappedSuperclassPersistentType.getMapping(); mappedSuperclass.setSpecifiedAccess(AccessType.PROPERTY); mappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE); ormResource().save(null); - mappedSuperclassPersistentType.setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); + mappedSuperclassPersistentType.setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); ormResource().save(null); - Embeddable embeddable = ormResource().getEntityMappings().getEmbeddables().get(0); + XmlEmbeddable embeddable = ormResource().getEntityMappings().getEmbeddables().get(0); assertEquals("model.Foo", embeddable.getClassName()); assertEquals(Boolean.TRUE, embeddable.getMetadataComplete()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, embeddable.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, embeddable.getAccess()); - XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) mappedSuperclassPersistentType.getMapping(); + GenericOrmEmbeddable xmlEmbeddable = (GenericOrmEmbeddable) mappedSuperclassPersistentType.getMapping(); assertEquals("model.Foo", xmlEmbeddable.getClass_()); assertEquals(Boolean.TRUE, xmlEmbeddable.getSpecifiedMetadataComplete()); assertEquals(AccessType.PROPERTY, xmlEmbeddable.getSpecifiedAccess()); } //test with 2 MappedSuperclasses, make the first one an Embeddable so it has to move to the end of the list public void testMakeMappedSuperclassEmbeddable2() throws Exception { - XmlPersistentType mappedSuperclassPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo2"); - XmlMappedSuperclass mappedSuperclass = (XmlMappedSuperclass) mappedSuperclassPersistentType.getMapping(); + OrmPersistentType mappedSuperclassPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo2"); + GenericOrmMappedSuperclass mappedSuperclass = (GenericOrmMappedSuperclass) mappedSuperclassPersistentType.getMapping(); mappedSuperclass.setSpecifiedAccess(AccessType.PROPERTY); mappedSuperclass.setSpecifiedMetadataComplete(Boolean.TRUE); ormResource().save(null); - mappedSuperclassPersistentType.setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); + mappedSuperclassPersistentType.setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); ormResource().save(null); - Embeddable embeddable = ormResource().getEntityMappings().getEmbeddables().get(0); + XmlEmbeddable embeddable = ormResource().getEntityMappings().getEmbeddables().get(0); assertEquals("model.Foo", embeddable.getClassName()); assertEquals(Boolean.TRUE, embeddable.getMetadataComplete()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.AccessType.PROPERTY, embeddable.getAccess()); + assertEquals(org.eclipse.jpt.core.resource.orm.AccessType.PROPERTY, embeddable.getAccess()); - XmlEmbeddable xmlEmbeddable = (XmlEmbeddable) mappedSuperclassPersistentType.getMapping(); + GenericOrmEmbeddable xmlEmbeddable = (GenericOrmEmbeddable) mappedSuperclassPersistentType.getMapping(); assertEquals("model.Foo", xmlEmbeddable.getClass_()); assertEquals(Boolean.TRUE, xmlEmbeddable.getSpecifiedMetadataComplete()); assertEquals(AccessType.PROPERTY, xmlEmbeddable.getSpecifiedAccess()); - ListIterator<XmlPersistentType> persistentTypes = entityMappings().xmlPersistentTypes(); - assertEquals(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); - assertEquals(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); + ListIterator<OrmPersistentType> persistentTypes = entityMappings().ormPersistentTypes(); + assertEquals(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); + assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, persistentTypes.next().mappingKey()); } public void testUpdateIdClass() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping(); - MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) ormPersistentType.getMapping(); + XmlMappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete()); assertNull(xmlMappedSuperclass.getIdClass()); assertNull(mappedSuperclassResource.getIdClass()); @@ -338,9 +338,9 @@ public class XmlMappedSuperclassTests extends ContextModelTestCase } public void testModifyIdClass() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); - XmlMappedSuperclass xmlMappedSuperclass = (XmlMappedSuperclass) xmlPersistentType.getMapping(); - MappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmMappedSuperclass xmlMappedSuperclass = (GenericOrmMappedSuperclass) ormPersistentType.getMapping(); + XmlMappedSuperclass mappedSuperclassResource = ormResource().getEntityMappings().getMappedSuperclasses().get(0); assertNull(xmlMappedSuperclass.getSpecifiedMetadataComplete()); assertNull(xmlMappedSuperclass.getIdClass()); assertNull(mappedSuperclassResource.getIdClass()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedNativeQueryTests.java index 7ada19bb4d..9bca1769f0 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedNativeQueryTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedNativeQueryTests.java @@ -11,16 +11,16 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.ListIterator; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlNamedNativeQuery; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.orm.XmlQueryHint; -import org.eclipse.jpt.core.internal.resource.orm.NamedNativeQuery; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmNamedNativeQuery; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmQueryHint; +import org.eclipse.jpt.core.resource.orm.XmlNamedNativeQuery; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlNamedNativeQueryTests extends ContextModelTestCase @@ -40,11 +40,11 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); - NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); + XmlNamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); assertNull(xmlNamedNativeQuery.getName()); assertNull(namedNativeQueryResource.getName()); @@ -61,11 +61,11 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); - NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); + XmlNamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); assertNull(xmlNamedNativeQuery.getName()); assertNull(namedNativeQueryResource.getName()); @@ -82,11 +82,11 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase } public void testUpdateQuery() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); - NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); + XmlNamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); assertNull(xmlNamedNativeQuery.getQuery()); assertNull(namedNativeQueryResource.getQuery()); @@ -103,11 +103,11 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase } public void testModifyQuery() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); - NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); + XmlNamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); assertNull(xmlNamedNativeQuery.getQuery()); assertNull(namedNativeQueryResource.getQuery()); @@ -124,31 +124,31 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase } public void testAddHint() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); - NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); + XmlNamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); - XmlQueryHint queryHint = xmlNamedNativeQuery.addHint(0); + GenericOrmQueryHint queryHint = xmlNamedNativeQuery.addHint(0); queryHint.setName("FOO"); assertEquals("FOO", namedNativeQueryResource.getHints().get(0).getName()); - XmlQueryHint queryHint2 = xmlNamedNativeQuery.addHint(0); + GenericOrmQueryHint queryHint2 = xmlNamedNativeQuery.addHint(0); queryHint2.setName("BAR"); assertEquals("BAR", namedNativeQueryResource.getHints().get(0).getName()); assertEquals("FOO", namedNativeQueryResource.getHints().get(1).getName()); - XmlQueryHint queryHint3 = xmlNamedNativeQuery.addHint(1); + GenericOrmQueryHint queryHint3 = xmlNamedNativeQuery.addHint(1); queryHint3.setName("BAZ"); assertEquals("BAR", namedNativeQueryResource.getHints().get(0).getName()); assertEquals("BAZ", namedNativeQueryResource.getHints().get(1).getName()); assertEquals("FOO", namedNativeQueryResource.getHints().get(2).getName()); - ListIterator<XmlQueryHint> queryHints = xmlNamedNativeQuery.hints(); + ListIterator<GenericOrmQueryHint> queryHints = xmlNamedNativeQuery.hints(); assertEquals(queryHint2, queryHints.next()); assertEquals(queryHint3, queryHints.next()); assertEquals(queryHint, queryHints.next()); @@ -160,11 +160,11 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase } public void testRemoveHint() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); - NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); + XmlNamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); xmlNamedNativeQuery.addHint(0).setName("FOO"); xmlNamedNativeQuery.addHint(1).setName("BAR"); @@ -186,11 +186,11 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase } public void testMoveHint() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); - NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); + XmlNamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); xmlNamedNativeQuery.addHint(0).setName("FOO"); xmlNamedNativeQuery.addHint(1).setName("BAR"); @@ -200,7 +200,7 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase xmlNamedNativeQuery.moveHint(2, 0); - ListIterator<XmlQueryHint> hints = xmlNamedNativeQuery.hints(); + ListIterator<GenericOrmQueryHint> hints = xmlNamedNativeQuery.hints(); assertEquals("BAR", hints.next().getName()); assertEquals("BAZ", hints.next().getName()); assertEquals("FOO", hints.next().getName()); @@ -222,11 +222,11 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase } public void testUpdateHints() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); - NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); + XmlNamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); namedNativeQueryResource.getHints().add(OrmFactory.eINSTANCE.createQueryHint()); namedNativeQueryResource.getHints().add(OrmFactory.eINSTANCE.createQueryHint()); @@ -236,7 +236,7 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase namedNativeQueryResource.getHints().get(1).setName("BAR"); namedNativeQueryResource.getHints().get(2).setName("BAZ"); - ListIterator<XmlQueryHint> hints = xmlNamedNativeQuery.hints(); + ListIterator<GenericOrmQueryHint> hints = xmlNamedNativeQuery.hints(); assertEquals("FOO", hints.next().getName()); assertEquals("BAR", hints.next().getName()); assertEquals("BAZ", hints.next().getName()); @@ -273,11 +273,11 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase public void testUpdateResultSetMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); - NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); + XmlNamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); assertEquals(null, namedNativeQueryResource.getResultSetMapping()); assertEquals(null, xmlNamedNativeQuery.getResultSetMapping()); @@ -294,11 +294,11 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase } public void testModifyResultSetMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); - NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); + XmlNamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); assertEquals(null, namedNativeQueryResource.getResultSetMapping()); assertEquals(null, xmlNamedNativeQuery.getResultSetMapping()); @@ -315,11 +315,11 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase } public void testUpdateResultClass() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); - NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); + XmlNamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); assertEquals(null, namedNativeQueryResource.getResultClass()); assertEquals(null, xmlNamedNativeQuery.getResultClass()); @@ -336,11 +336,11 @@ public class XmlNamedNativeQueryTests extends ContextModelTestCase } public void testModifyResultClass() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedNativeQuery xmlNamedNativeQuery = xmlEntity.addNamedNativeQuery(0); - NamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); + XmlNamedNativeQuery namedNativeQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedNativeQueries().get(0); assertEquals(null, namedNativeQueryResource.getResultClass()); assertEquals(null, xmlNamedNativeQuery.getResultClass()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedQueryTests.java index dbae9442c9..2d4428874d 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedQueryTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlNamedQueryTests.java @@ -11,16 +11,16 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.ListIterator; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlNamedQuery; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.orm.XmlQueryHint; -import org.eclipse.jpt.core.internal.resource.orm.NamedQuery; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmNamedQuery; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmQueryHint; +import org.eclipse.jpt.core.resource.orm.XmlNamedQuery; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlNamedQueryTests extends ContextModelTestCase @@ -40,11 +40,11 @@ public class XmlNamedQueryTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); - NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); + XmlNamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); assertNull(xmlNamedQuery.getName()); assertNull(namedQueryResource.getName()); @@ -61,11 +61,11 @@ public class XmlNamedQueryTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); - NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); + XmlNamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); assertNull(xmlNamedQuery.getName()); assertNull(namedQueryResource.getName()); @@ -82,11 +82,11 @@ public class XmlNamedQueryTests extends ContextModelTestCase } public void testUpdateQuery() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); - NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); + XmlNamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); assertNull(xmlNamedQuery.getQuery()); assertNull(namedQueryResource.getQuery()); @@ -103,11 +103,11 @@ public class XmlNamedQueryTests extends ContextModelTestCase } public void testModifyQuery() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); - NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); + XmlNamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); assertNull(xmlNamedQuery.getQuery()); assertNull(namedQueryResource.getQuery()); @@ -124,31 +124,31 @@ public class XmlNamedQueryTests extends ContextModelTestCase } public void testAddHint() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); - NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); + XmlNamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); - XmlQueryHint queryHint = xmlNamedQuery.addHint(0); + GenericOrmQueryHint queryHint = xmlNamedQuery.addHint(0); queryHint.setName("FOO"); assertEquals("FOO", namedQueryResource.getHints().get(0).getName()); - XmlQueryHint queryHint2 = xmlNamedQuery.addHint(0); + GenericOrmQueryHint queryHint2 = xmlNamedQuery.addHint(0); queryHint2.setName("BAR"); assertEquals("BAR", namedQueryResource.getHints().get(0).getName()); assertEquals("FOO", namedQueryResource.getHints().get(1).getName()); - XmlQueryHint queryHint3 = xmlNamedQuery.addHint(1); + GenericOrmQueryHint queryHint3 = xmlNamedQuery.addHint(1); queryHint3.setName("BAZ"); assertEquals("BAR", namedQueryResource.getHints().get(0).getName()); assertEquals("BAZ", namedQueryResource.getHints().get(1).getName()); assertEquals("FOO", namedQueryResource.getHints().get(2).getName()); - ListIterator<XmlQueryHint> queryHints = xmlNamedQuery.hints(); + ListIterator<GenericOrmQueryHint> queryHints = xmlNamedQuery.hints(); assertEquals(queryHint2, queryHints.next()); assertEquals(queryHint3, queryHints.next()); assertEquals(queryHint, queryHints.next()); @@ -160,11 +160,11 @@ public class XmlNamedQueryTests extends ContextModelTestCase } public void testRemoveHint() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); - NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); + XmlNamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); xmlNamedQuery.addHint(0).setName("FOO"); xmlNamedQuery.addHint(1).setName("BAR"); @@ -186,11 +186,11 @@ public class XmlNamedQueryTests extends ContextModelTestCase } public void testMoveHint() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); - NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); + XmlNamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); xmlNamedQuery.addHint(0).setName("FOO"); xmlNamedQuery.addHint(1).setName("BAR"); @@ -200,7 +200,7 @@ public class XmlNamedQueryTests extends ContextModelTestCase xmlNamedQuery.moveHint(2, 0); - ListIterator<XmlQueryHint> hints = xmlNamedQuery.hints(); + ListIterator<GenericOrmQueryHint> hints = xmlNamedQuery.hints(); assertEquals("BAR", hints.next().getName()); assertEquals("BAZ", hints.next().getName()); assertEquals("FOO", hints.next().getName()); @@ -222,11 +222,11 @@ public class XmlNamedQueryTests extends ContextModelTestCase } public void testUpdateHints() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmNamedQuery xmlNamedQuery = xmlEntity.addNamedQuery(0); - NamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); + XmlNamedQuery namedQueryResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0); namedQueryResource.getHints().add(OrmFactory.eINSTANCE.createQueryHint()); namedQueryResource.getHints().add(OrmFactory.eINSTANCE.createQueryHint()); @@ -236,7 +236,7 @@ public class XmlNamedQueryTests extends ContextModelTestCase namedQueryResource.getHints().get(1).setName("BAR"); namedQueryResource.getHints().get(2).setName("BAZ"); - ListIterator<XmlQueryHint> hints = xmlNamedQuery.hints(); + ListIterator<GenericOrmQueryHint> hints = xmlNamedQuery.hints(); assertEquals("FOO", hints.next().getName()); assertEquals("BAR", hints.next().getName()); assertEquals("BAZ", hints.next().getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToManyMappingTests.java index 08c30f526f..cafca8440d 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToManyMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToManyMappingTests.java @@ -10,28 +10,28 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.orm; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.FetchType; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IJoinColumn; -import org.eclipse.jpt.core.internal.context.base.IJoinTable; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlOneToManyMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.orm.OneToMany; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.FetchType; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.JoinColumn; +import org.eclipse.jpt.core.context.JoinTable; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmOneToManyMapping; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.orm.XmlOneToMany; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlOneToManyMappingTests extends ContextModelTestCase @@ -51,10 +51,10 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); - OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); + XmlOneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); assertEquals("oneToManyMapping", xmlOneToManyMapping.getName()); assertEquals("oneToManyMapping", oneToMany.getName()); @@ -71,10 +71,10 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); - OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); + XmlOneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); assertEquals("oneToManyMapping", xmlOneToManyMapping.getName()); assertEquals("oneToManyMapping", oneToMany.getName()); @@ -91,10 +91,10 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testUpdateTargetEntity() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); - OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); + XmlOneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); ormResource().save(null); assertNull(xmlOneToManyMapping.getSpecifiedTargetEntity()); @@ -114,10 +114,10 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testModifyTargetEntity() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); - OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); + XmlOneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); assertNull(xmlOneToManyMapping.getSpecifiedTargetEntity()); assertNull(oneToMany.getTargetEntity()); @@ -134,22 +134,22 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testUpdateSpecifiedFetch() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); - OneToMany oneToManyResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); + XmlOneToMany oneToManyResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); assertNull(xmlOneToManyMapping.getSpecifiedFetch()); assertNull(oneToManyResource.getFetch()); //set fetch in the resource model, verify context model updated - oneToManyResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER); + oneToManyResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.EAGER); assertEquals(FetchType.EAGER, xmlOneToManyMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, oneToManyResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, oneToManyResource.getFetch()); - oneToManyResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY); + oneToManyResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.LAZY); assertEquals(FetchType.LAZY, xmlOneToManyMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, oneToManyResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, oneToManyResource.getFetch()); //set fetch to null in the resource model oneToManyResource.setFetch(null); @@ -158,21 +158,21 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testModifySpecifiedFetch() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); - OneToMany oneToManyResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); + XmlOneToMany oneToManyResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); assertNull(xmlOneToManyMapping.getSpecifiedFetch()); assertNull(oneToManyResource.getFetch()); //set fetch in the context model, verify resource model updated xmlOneToManyMapping.setSpecifiedFetch(FetchType.EAGER); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, oneToManyResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, oneToManyResource.getFetch()); assertEquals(FetchType.EAGER, xmlOneToManyMapping.getSpecifiedFetch()); xmlOneToManyMapping.setSpecifiedFetch(FetchType.LAZY); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, oneToManyResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, oneToManyResource.getFetch()); assertEquals(FetchType.LAZY, xmlOneToManyMapping.getSpecifiedFetch()); //set fetch to null in the context model @@ -182,10 +182,10 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testUpdateMappedBy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); - OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); + XmlOneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); assertNull(xmlOneToManyMapping.getMappedBy()); assertNull(oneToMany.getMappedBy()); @@ -202,10 +202,10 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testModifyMappedBy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); - OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); + XmlOneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); assertNull(xmlOneToManyMapping.getMappedBy()); assertNull(oneToMany.getMappedBy()); @@ -223,10 +223,10 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase public void testUpdateMapKey() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); - OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); + XmlOneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); assertNull(xmlOneToManyMapping.getMapKey()); assertNull(oneToMany.getMapKey()); @@ -253,10 +253,10 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testModifyMapKey() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); - OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); + XmlOneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); assertNull(xmlOneToManyMapping.getMapKey()); assertNull(oneToMany.getMapKey()); @@ -273,10 +273,10 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testUpdateOrderBy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); - OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); + XmlOneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); assertNull(xmlOneToManyMapping.getOrderBy()); assertNull(oneToMany.getOrderBy()); @@ -293,10 +293,10 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testModifyOrderBy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); - OneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); + XmlOneToMany oneToMany = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToManys().get(0); assertNull(xmlOneToManyMapping.getOrderBy()); assertNull(oneToMany.getOrderBy()); @@ -313,9 +313,9 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testIsNoOrdering() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); assertTrue(xmlOneToManyMapping.isNoOrdering()); @@ -327,9 +327,9 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testSetNoOrdering() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); assertTrue(xmlOneToManyMapping.isNoOrdering()); @@ -350,9 +350,9 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase // } public void testIsCustomOrdering() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); - XmlOneToManyMapping xmlOneToManyMapping = (XmlOneToManyMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToManyMapping"); + GenericOrmOneToManyMapping xmlOneToManyMapping = (GenericOrmOneToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(xmlOneToManyMapping.isCustomOrdering()); @@ -364,10 +364,10 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testOneToManyMorphToIdMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) xmlPersistentAttribute.getMapping(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToManyMapping.isDefault()); oneToManyMapping.setSpecifiedFetch(FetchType.EAGER); oneToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -375,26 +375,26 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase oneToManyMapping.setMapKey("mapKey"); oneToManyMapping.setMappedBy("mappedBy"); oneToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(oneToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof IdMapping); assertEquals("oneToMany", xmlPersistentAttribute.getMapping().getName()); } public void testOneToManyMorphToVersionMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) xmlPersistentAttribute.getMapping(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToManyMapping.isDefault()); oneToManyMapping.setSpecifiedFetch(FetchType.EAGER); oneToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -402,26 +402,26 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase oneToManyMapping.setMapKey("mapKey"); oneToManyMapping.setMappedBy("mappedBy"); oneToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(oneToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IVersionMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof VersionMapping); assertEquals("oneToMany", xmlPersistentAttribute.getMapping().getName()); } public void testOneToManyMorphToTransientMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) xmlPersistentAttribute.getMapping(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToManyMapping.isDefault()); oneToManyMapping.setSpecifiedFetch(FetchType.EAGER); oneToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -429,26 +429,26 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase oneToManyMapping.setMapKey("mapKey"); oneToManyMapping.setMappedBy("mappedBy"); oneToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(oneToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof ITransientMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof TransientMapping); assertEquals("oneToMany", xmlPersistentAttribute.getMapping().getName()); } public void testOneToManyMorphToEmbeddedMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) xmlPersistentAttribute.getMapping(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToManyMapping.isDefault()); oneToManyMapping.setSpecifiedFetch(FetchType.EAGER); oneToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -456,26 +456,26 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase oneToManyMapping.setMapKey("mapKey"); oneToManyMapping.setMappedBy("mappedBy"); oneToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(oneToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedMapping); assertEquals("oneToMany", xmlPersistentAttribute.getMapping().getName()); } public void testOneToManyMorphToEmbeddedIdMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) xmlPersistentAttribute.getMapping(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToManyMapping.isDefault()); oneToManyMapping.setSpecifiedFetch(FetchType.EAGER); oneToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -483,26 +483,26 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase oneToManyMapping.setMapKey("mapKey"); oneToManyMapping.setMappedBy("mappedBy"); oneToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(oneToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedIdMapping); assertEquals("oneToMany", xmlPersistentAttribute.getMapping().getName()); } public void testOneToManyMorphToOneToOneMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) xmlPersistentAttribute.getMapping(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToManyMapping.isDefault()); oneToManyMapping.setSpecifiedFetch(FetchType.EAGER); oneToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -515,34 +515,34 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase oneToManyMapping.getCascade().setRefresh(true); oneToManyMapping.getCascade().setRemove(true); oneToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(oneToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToOneMapping); assertEquals("oneToMany", xmlPersistentAttribute.getMapping().getName()); - assertEquals(FetchType.EAGER, ((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); - assertEquals("TargetEntity", ((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); - assertEquals("mappedBy", ((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getMappedBy()); - assertTrue(((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); - assertTrue(((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); - assertTrue(((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); - assertTrue(((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); - assertTrue(((IOneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); + assertEquals(FetchType.EAGER, ((OneToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); + assertEquals("TargetEntity", ((OneToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); + assertEquals("mappedBy", ((OneToOneMapping) xmlPersistentAttribute.getMapping()).getMappedBy()); + assertTrue(((OneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); + assertTrue(((OneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); + assertTrue(((OneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); + assertTrue(((OneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); + assertTrue(((OneToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); } public void testOneToManyMorphToManyToManyMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) xmlPersistentAttribute.getMapping(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToManyMapping.isDefault()); oneToManyMapping.setSpecifiedFetch(FetchType.EAGER); oneToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -555,28 +555,28 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase oneToManyMapping.getCascade().setRefresh(true); oneToManyMapping.getCascade().setRemove(true); oneToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(oneToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToManyMapping); assertEquals("oneToMany", xmlPersistentAttribute.getMapping().getName()); - assertEquals(FetchType.EAGER, ((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); - assertEquals("TargetEntity", ((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); - assertEquals("mappedBy", ((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getMappedBy()); - assertTrue(((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); - assertTrue(((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); - assertTrue(((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); - assertTrue(((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); - assertTrue(((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); - IJoinTable joinTable = ((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getJoinTable(); + assertEquals(FetchType.EAGER, ((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); + assertEquals("TargetEntity", ((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); + assertEquals("mappedBy", ((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getMappedBy()); + assertTrue(((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); + assertTrue(((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); + assertTrue(((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); + assertTrue(((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); + assertTrue(((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); + JoinTable joinTable = ((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getJoinTable(); assertEquals("MY_JOIN_TABLE", joinTable.getName()); assertEquals("name", joinTable.joinColumns().next().getSpecifiedName()); assertEquals("referenceName", joinTable.joinColumns().next().getSpecifiedReferencedColumnName()); @@ -585,10 +585,10 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase } public void testOneToManyMorphToManyToOneMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) xmlPersistentAttribute.getMapping(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToManyMapping.isDefault()); oneToManyMapping.setSpecifiedFetch(FetchType.EAGER); oneToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -601,33 +601,33 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase oneToManyMapping.getCascade().setRefresh(true); oneToManyMapping.getCascade().setRemove(true); oneToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(oneToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToOneMapping); assertEquals("oneToMany", xmlPersistentAttribute.getMapping().getName()); - assertEquals(FetchType.EAGER, ((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); - assertEquals("TargetEntity", ((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); + assertEquals(FetchType.EAGER, ((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); + assertEquals("TargetEntity", ((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); } public void testOneToManyMorphToBasicMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, "oneToMany"); - IOneToManyMapping oneToManyMapping = (IOneToManyMapping) xmlPersistentAttribute.getMapping(); + OneToManyMapping oneToManyMapping = (OneToManyMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToManyMapping.isDefault()); oneToManyMapping.setSpecifiedFetch(FetchType.EAGER); oneToManyMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -640,18 +640,18 @@ public class XmlOneToManyMappingTests extends ContextModelTestCase oneToManyMapping.getCascade().setRefresh(true); oneToManyMapping.getCascade().setRemove(true); oneToManyMapping.getJoinTable().setSpecifiedName("MY_JOIN_TABLE"); - IJoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToManyMapping.getJoinTable().addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); - IJoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); + JoinColumn inverseJoinColumn = oneToManyMapping.getJoinTable().addSpecifiedInverseJoinColumn(0); inverseJoinColumn.setSpecifiedName("inverseName"); inverseJoinColumn.setSpecifiedReferencedColumnName("inverseReferenceName"); assertFalse(oneToManyMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IBasicMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof BasicMapping); assertEquals("oneToMany", xmlPersistentAttribute.getMapping().getName()); //TODO assertEquals(FetchType.EAGER, ((IBasicMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToOneMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToOneMappingTests.java index 44c0fef7ab..6aa97a5841 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToOneMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlOneToOneMappingTests.java @@ -13,29 +13,29 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.FetchType; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IJoinColumn; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlCascade; -import org.eclipse.jpt.core.internal.context.orm.XmlJoinColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlOneToOneMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.OneToOne; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.FetchType; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.JoinColumn; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmJoinColumn; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmOneToOneMapping; +import org.eclipse.jpt.core.internal.context.orm.OrmCascade; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlOneToOne; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -141,10 +141,10 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase return this.javaProject.createType(PACKAGE_NAME, "Address.java", sourceWriter); } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); assertEquals("oneToOneMapping", xmlOneToOneMapping.getName()); assertEquals("oneToOneMapping", oneToOne.getName()); @@ -161,10 +161,10 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); assertEquals("oneToOneMapping", xmlOneToOneMapping.getName()); assertEquals("oneToOneMapping", oneToOne.getName()); @@ -181,10 +181,10 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase } public void testUpdateSpecifiedTargetEntity() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); assertNull(xmlOneToOneMapping.getSpecifiedTargetEntity()); assertNull(oneToOne.getTargetEntity()); @@ -201,10 +201,10 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase } public void testModifySpecifiedTargetEntity() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); assertNull(xmlOneToOneMapping.getSpecifiedTargetEntity()); assertNull(oneToOne.getTargetEntity()); @@ -221,22 +221,22 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase } public void testUpdateSpecifiedFetch() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); assertNull(xmlOneToOneMapping.getSpecifiedFetch()); assertNull(oneToOneResource.getFetch()); //set fetch in the resource model, verify context model updated - oneToOneResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER); + oneToOneResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.EAGER); assertEquals(FetchType.EAGER, xmlOneToOneMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, oneToOneResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, oneToOneResource.getFetch()); - oneToOneResource.setFetch(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY); + oneToOneResource.setFetch(org.eclipse.jpt.core.resource.orm.FetchType.LAZY); assertEquals(FetchType.LAZY, xmlOneToOneMapping.getSpecifiedFetch()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, oneToOneResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, oneToOneResource.getFetch()); //set fetch to null in the resource model oneToOneResource.setFetch(null); @@ -245,21 +245,21 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase } public void testModifySpecifiedFetch() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); assertNull(xmlOneToOneMapping.getSpecifiedFetch()); assertNull(oneToOneResource.getFetch()); //set fetch in the context model, verify resource model updated xmlOneToOneMapping.setSpecifiedFetch(FetchType.EAGER); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.EAGER, oneToOneResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.EAGER, oneToOneResource.getFetch()); assertEquals(FetchType.EAGER, xmlOneToOneMapping.getSpecifiedFetch()); xmlOneToOneMapping.setSpecifiedFetch(FetchType.LAZY); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.FetchType.LAZY, oneToOneResource.getFetch()); + assertEquals(org.eclipse.jpt.core.resource.orm.FetchType.LAZY, oneToOneResource.getFetch()); assertEquals(FetchType.LAZY, xmlOneToOneMapping.getSpecifiedFetch()); //set fetch to null in the context model @@ -269,10 +269,10 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase } public void testUpdateMappedBy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); assertNull(xmlOneToOneMapping.getMappedBy()); assertNull(oneToOne.getMappedBy()); @@ -289,10 +289,10 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase } public void testModifyMappedBy() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOne = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); assertNull(xmlOneToOneMapping.getMappedBy()); assertNull(oneToOne.getMappedBy()); @@ -310,10 +310,10 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase public void testUpdateSpecifiedOptional() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); assertNull(xmlOneToOneMapping.getSpecifiedOptional()); assertNull(oneToOneResource.getOptional()); @@ -334,10 +334,10 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase } public void testModifySpecifiedOptional() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); assertNull(xmlOneToOneMapping.getSpecifiedOptional()); assertNull(oneToOneResource.getOptional()); @@ -358,19 +358,19 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase } public void testAddSpecifiedJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); - XmlJoinColumn joinColumn = xmlOneToOneMapping.addSpecifiedJoinColumn(0); + GenericOrmJoinColumn joinColumn = xmlOneToOneMapping.addSpecifiedJoinColumn(0); ormResource().save(null); joinColumn.setSpecifiedName("FOO"); ormResource().save(null); assertEquals("FOO", oneToOneResource.getJoinColumns().get(0).getName()); - XmlJoinColumn joinColumn2 = xmlOneToOneMapping.addSpecifiedJoinColumn(0); + GenericOrmJoinColumn joinColumn2 = xmlOneToOneMapping.addSpecifiedJoinColumn(0); ormResource().save(null); joinColumn2.setSpecifiedName("BAR"); ormResource().save(null); @@ -378,7 +378,7 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase assertEquals("BAR", oneToOneResource.getJoinColumns().get(0).getName()); assertEquals("FOO", oneToOneResource.getJoinColumns().get(1).getName()); - XmlJoinColumn joinColumn3 = xmlOneToOneMapping.addSpecifiedJoinColumn(1); + GenericOrmJoinColumn joinColumn3 = xmlOneToOneMapping.addSpecifiedJoinColumn(1); ormResource().save(null); joinColumn3.setSpecifiedName("BAZ"); ormResource().save(null); @@ -387,7 +387,7 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase assertEquals("BAZ", oneToOneResource.getJoinColumns().get(1).getName()); assertEquals("FOO", oneToOneResource.getJoinColumns().get(2).getName()); - ListIterator<XmlJoinColumn> joinColumns = xmlOneToOneMapping.specifiedJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = xmlOneToOneMapping.specifiedJoinColumns(); assertEquals(joinColumn2, joinColumns.next()); assertEquals(joinColumn3, joinColumns.next()); assertEquals(joinColumn, joinColumns.next()); @@ -399,10 +399,10 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase } public void testRemoveSpecifiedJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); xmlOneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); xmlOneToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); @@ -424,10 +424,10 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase } public void testMoveSpecifiedJoinColumn() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); - OneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOneMapping"); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); + XmlOneToOne oneToOneResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getOneToOnes().get(0); xmlOneToOneMapping.addSpecifiedJoinColumn(0).setSpecifiedName("FOO"); xmlOneToOneMapping.addSpecifiedJoinColumn(1).setSpecifiedName("BAR"); @@ -437,7 +437,7 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase xmlOneToOneMapping.moveSpecifiedJoinColumn(2, 0); - ListIterator<XmlJoinColumn> joinColumns = xmlOneToOneMapping.specifiedJoinColumns(); + ListIterator<GenericOrmJoinColumn> joinColumns = xmlOneToOneMapping.specifiedJoinColumns(); assertEquals("BAR", joinColumns.next().getName()); assertEquals("BAZ", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); @@ -462,13 +462,13 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase createTestEntityOneToOneMapping(); createTestTargetEntityAddress(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "foo"); - assertEquals(3, xmlPersistentType.virtualAttributesSize()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "foo"); + assertEquals(3, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); assertEquals("foo", xmlOneToOneMapping.getName()); @@ -485,7 +485,7 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase //assertTrue(xmlOneToOneMapping.defaultJoinColumns().hasNext()); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertFalse(xmlCascade.isAll()); assertFalse(xmlCascade.isMerge()); assertFalse(xmlCascade.isPersist()); @@ -498,19 +498,19 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase createTestEntityOneToOneMapping(); createTestTargetEntityAddress(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); - assertEquals(3, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); + assertEquals(3, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); assertEquals("address", xmlOneToOneMapping.getName()); assertEquals(FetchType.LAZY, xmlOneToOneMapping.getSpecifiedFetch()); assertEquals(Boolean.FALSE, xmlOneToOneMapping.getSpecifiedOptional()); assertEquals("Address", xmlOneToOneMapping.getSpecifiedTargetEntity()); assertNull(xmlOneToOneMapping.getMappedBy()); - XmlJoinColumn xmlJoinColumn = xmlOneToOneMapping.specifiedJoinColumns().next(); + GenericOrmJoinColumn xmlJoinColumn = xmlOneToOneMapping.specifiedJoinColumns().next(); assertEquals("MY_COLUMN", xmlJoinColumn.getSpecifiedName()); assertEquals("MY_REFERENCED_COLUMN", xmlJoinColumn.getSpecifiedReferencedColumnName()); assertEquals(Boolean.TRUE, xmlJoinColumn.getSpecifiedUnique()); @@ -520,7 +520,7 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase assertEquals("COLUMN_DEFINITION", xmlJoinColumn.getColumnDefinition()); assertEquals("MY_TABLE", xmlJoinColumn.getSpecifiedTable()); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertTrue(xmlCascade.isAll()); assertTrue(xmlCascade.isMerge()); assertTrue(xmlCascade.isPersist()); @@ -532,13 +532,13 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase createTestEntityOneToOneMapping(); createTestTargetEntityAddress(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); - xmlPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); - assertEquals(3, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); + ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); + assertEquals(3, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); assertEquals("address", xmlOneToOneMapping.getName()); assertEquals(FetchType.EAGER, xmlOneToOneMapping.getSpecifiedFetch()); assertEquals(Boolean.TRUE, xmlOneToOneMapping.getSpecifiedOptional()); @@ -558,7 +558,7 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase // assertNull(xmlJoinColumn.getColumnDefinition()); // assertEquals(TYPE_NAME, xmlJoinColumn.getSpecifiedTable()); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertFalse(xmlCascade.isAll()); assertFalse(xmlCascade.isMerge()); assertFalse(xmlCascade.isPersist()); @@ -570,14 +570,14 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase createTestEntityOneToOneMapping(); createTestTargetEntityAddress(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Address"); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address"); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "address"); + assertEquals(2, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlOneToOneMapping xmlOneToOneMapping = (XmlOneToOneMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmOneToOneMapping xmlOneToOneMapping = (GenericOrmOneToOneMapping) xmlPersistentAttribute.getMapping(); assertEquals("address", xmlOneToOneMapping.getName()); assertNull(xmlOneToOneMapping.getSpecifiedFetch()); @@ -611,7 +611,7 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase // assertEquals(null, xmlJoinColumn.getColumnDefinition()); // assertEquals(TYPE_NAME, xmlJoinColumn.getDefaultTable()); - XmlCascade xmlCascade = xmlOneToOneMapping.getCascade(); + OrmCascade xmlCascade = xmlOneToOneMapping.getCascade(); assertFalse(xmlCascade.isAll()); assertFalse(xmlCascade.isMerge()); assertFalse(xmlCascade.isPersist()); @@ -621,10 +621,10 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase public void testOneToOneMorphToIdMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) xmlPersistentAttribute.getMapping(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToOneMapping.isDefault()); oneToOneMapping.setSpecifiedFetch(FetchType.EAGER); oneToOneMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -634,23 +634,23 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.getCascade().setPersist(true); oneToOneMapping.getCascade().setRefresh(true); oneToOneMapping.getCascade().setRemove(true); - IJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); assertFalse(oneToOneMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof IdMapping); assertEquals("oneToOne", xmlPersistentAttribute.getMapping().getName()); } public void testOneToOneMorphToVersionMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) xmlPersistentAttribute.getMapping(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToOneMapping.isDefault()); oneToOneMapping.setSpecifiedFetch(FetchType.EAGER); oneToOneMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -660,23 +660,23 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.getCascade().setPersist(true); oneToOneMapping.getCascade().setRefresh(true); oneToOneMapping.getCascade().setRemove(true); - IJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); assertFalse(oneToOneMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IVersionMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof VersionMapping); assertEquals("oneToOne", xmlPersistentAttribute.getMapping().getName()); } public void testOneToOneMorphToTransientMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) xmlPersistentAttribute.getMapping(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToOneMapping.isDefault()); oneToOneMapping.setSpecifiedFetch(FetchType.EAGER); oneToOneMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -686,23 +686,23 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.getCascade().setPersist(true); oneToOneMapping.getCascade().setRefresh(true); oneToOneMapping.getCascade().setRemove(true); - IJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); assertFalse(oneToOneMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof ITransientMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof TransientMapping); assertEquals("oneToOne", xmlPersistentAttribute.getMapping().getName()); } public void testOneToOneMorphToEmbeddedMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) xmlPersistentAttribute.getMapping(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToOneMapping.isDefault()); oneToOneMapping.setSpecifiedFetch(FetchType.EAGER); oneToOneMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -712,23 +712,23 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.getCascade().setPersist(true); oneToOneMapping.getCascade().setRefresh(true); oneToOneMapping.getCascade().setRemove(true); - IJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); assertFalse(oneToOneMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedMapping); assertEquals("oneToOne", xmlPersistentAttribute.getMapping().getName()); } public void testOneToOneMorphToEmbeddedIdMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) xmlPersistentAttribute.getMapping(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToOneMapping.isDefault()); oneToOneMapping.setSpecifiedFetch(FetchType.EAGER); oneToOneMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -738,23 +738,23 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.getCascade().setPersist(true); oneToOneMapping.getCascade().setRefresh(true); oneToOneMapping.getCascade().setRemove(true); - IJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); assertFalse(oneToOneMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedIdMapping); assertEquals("oneToOne", xmlPersistentAttribute.getMapping().getName()); } public void testOneToOneMorphToManyToManyMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) xmlPersistentAttribute.getMapping(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToOneMapping.isDefault()); oneToOneMapping.setSpecifiedFetch(FetchType.EAGER); oneToOneMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -764,31 +764,31 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.getCascade().setPersist(true); oneToOneMapping.getCascade().setRefresh(true); oneToOneMapping.getCascade().setRemove(true); - IJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); assertFalse(oneToOneMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToManyMapping); assertEquals("oneToOne", xmlPersistentAttribute.getMapping().getName()); - assertEquals(FetchType.EAGER, ((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); - assertEquals("TargetEntity", ((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); - assertEquals("mappedBy", ((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getMappedBy()); - assertTrue(((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); - assertTrue(((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); - assertTrue(((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); - assertTrue(((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); - assertTrue(((IManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); + assertEquals(FetchType.EAGER, ((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); + assertEquals("TargetEntity", ((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); + assertEquals("mappedBy", ((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getMappedBy()); + assertTrue(((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); + assertTrue(((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); + assertTrue(((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); + assertTrue(((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); + assertTrue(((ManyToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); } public void testOneToOneMorphToOneToManyMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) xmlPersistentAttribute.getMapping(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToOneMapping.isDefault()); oneToOneMapping.setSpecifiedFetch(FetchType.EAGER); oneToOneMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -798,31 +798,31 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.getCascade().setPersist(true); oneToOneMapping.getCascade().setRefresh(true); oneToOneMapping.getCascade().setRemove(true); - IJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); assertFalse(oneToOneMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToManyMapping); assertEquals("oneToOne", xmlPersistentAttribute.getMapping().getName()); - assertEquals(FetchType.EAGER, ((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); - assertEquals("TargetEntity", ((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); - assertEquals("mappedBy", ((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getMappedBy()); - assertTrue(((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); - assertTrue(((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); - assertTrue(((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); - assertTrue(((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); - assertTrue(((IOneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); + assertEquals(FetchType.EAGER, ((OneToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); + assertEquals("TargetEntity", ((OneToManyMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); + assertEquals("mappedBy", ((OneToManyMapping) xmlPersistentAttribute.getMapping()).getMappedBy()); + assertTrue(((OneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); + assertTrue(((OneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); + assertTrue(((OneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); + assertTrue(((OneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); + assertTrue(((OneToManyMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); } public void testOneToOneMorphToManyToOneMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) xmlPersistentAttribute.getMapping(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToOneMapping.isDefault()); oneToOneMapping.setSpecifiedFetch(FetchType.EAGER); oneToOneMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -832,34 +832,34 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.getCascade().setPersist(true); oneToOneMapping.getCascade().setRefresh(true); oneToOneMapping.getCascade().setRemove(true); - IJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); assertFalse(oneToOneMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToOneMapping); assertEquals("oneToOne", xmlPersistentAttribute.getMapping().getName()); - assertEquals(FetchType.EAGER, ((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); - assertEquals("TargetEntity", ((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); - assertTrue(((IManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); - - joinColumn = ((IManyToOneMapping) xmlPersistentAttribute.getMapping()).specifiedJoinColumns().next(); + assertEquals(FetchType.EAGER, ((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); + assertEquals("TargetEntity", ((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getSpecifiedTargetEntity()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isAll()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isMerge()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isPersist()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRefresh()); + assertTrue(((ManyToOneMapping) xmlPersistentAttribute.getMapping()).getCascade().isRemove()); + + joinColumn = ((ManyToOneMapping) xmlPersistentAttribute.getMapping()).specifiedJoinColumns().next(); assertEquals("name", joinColumn.getName()); assertEquals("referenceName", joinColumn.getReferencedColumnName()); } public void testOneToOneMorphToBasicMapping() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, "oneToOne"); - IOneToOneMapping oneToOneMapping = (IOneToOneMapping) xmlPersistentAttribute.getMapping(); + OneToOneMapping oneToOneMapping = (OneToOneMapping) xmlPersistentAttribute.getMapping(); assertFalse(oneToOneMapping.isDefault()); oneToOneMapping.setSpecifiedFetch(FetchType.EAGER); oneToOneMapping.setSpecifiedTargetEntity("TargetEntity"); @@ -869,15 +869,15 @@ public class XmlOneToOneMappingTests extends ContextModelTestCase oneToOneMapping.getCascade().setPersist(true); oneToOneMapping.getCascade().setRefresh(true); oneToOneMapping.getCascade().setRemove(true); - IJoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); + JoinColumn joinColumn = oneToOneMapping.addSpecifiedJoinColumn(0); joinColumn.setSpecifiedName("name"); joinColumn.setSpecifiedReferencedColumnName("referenceName"); assertFalse(oneToOneMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IBasicMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof BasicMapping); assertEquals("oneToOne", xmlPersistentAttribute.getMapping().getName()); //TODO assertEquals(FetchType.EAGER, ((IBasicMapping) xmlPersistentAttribute.getMapping()).getSpecifiedFetch()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPersistentTypeTests.java index c8cc012285..ed7ba1408e 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPersistentTypeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPersistentTypeTests.java @@ -12,29 +12,29 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import java.util.ListIterator; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.resource.orm.Basic; -import org.eclipse.jpt.core.internal.resource.orm.BasicImpl; -import org.eclipse.jpt.core.internal.resource.orm.Embedded; -import org.eclipse.jpt.core.internal.resource.orm.EmbeddedIdImpl; -import org.eclipse.jpt.core.internal.resource.orm.EmbeddedImpl; -import org.eclipse.jpt.core.internal.resource.orm.Entity; -import org.eclipse.jpt.core.internal.resource.orm.Id; -import org.eclipse.jpt.core.internal.resource.orm.IdImpl; -import org.eclipse.jpt.core.internal.resource.orm.ManyToManyImpl; -import org.eclipse.jpt.core.internal.resource.orm.ManyToOneImpl; -import org.eclipse.jpt.core.internal.resource.orm.OneToManyImpl; -import org.eclipse.jpt.core.internal.resource.orm.OneToOneImpl; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.orm.Transient; -import org.eclipse.jpt.core.internal.resource.orm.TransientImpl; -import org.eclipse.jpt.core.internal.resource.orm.Version; -import org.eclipse.jpt.core.internal.resource.orm.VersionImpl; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.resource.orm.XmlBasic; +import org.eclipse.jpt.core.resource.orm.BasicImpl; +import org.eclipse.jpt.core.resource.orm.XmlEmbedded; +import org.eclipse.jpt.core.resource.orm.EmbeddedIdImpl; +import org.eclipse.jpt.core.resource.orm.EmbeddedImpl; +import org.eclipse.jpt.core.resource.orm.XmlEntity; +import org.eclipse.jpt.core.resource.orm.XmlId; +import org.eclipse.jpt.core.resource.orm.IdImpl; +import org.eclipse.jpt.core.resource.orm.ManyToManyImpl; +import org.eclipse.jpt.core.resource.orm.ManyToOneImpl; +import org.eclipse.jpt.core.resource.orm.OneToManyImpl; +import org.eclipse.jpt.core.resource.orm.OneToOneImpl; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.orm.XmlTransient; +import org.eclipse.jpt.core.resource.orm.TransientImpl; +import org.eclipse.jpt.core.resource.orm.XmlVersion; +import org.eclipse.jpt.core.resource.orm.VersionImpl; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlPersistentTypeTests extends ContextModelTestCase @@ -54,7 +54,7 @@ public class XmlPersistentTypeTests extends ContextModelTestCase } // public void testUpdateXmlTypeMapping() throws Exception { -// assertFalse(entityMappings().xmlPersistentTypes().hasNext()); +// assertFalse(entityMappings().ormPersistentTypes().hasNext()); // assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); // assertTrue(ormResource().getEntityMappings().getEntities().isEmpty()); // assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty()); @@ -63,8 +63,8 @@ public class XmlPersistentTypeTests extends ContextModelTestCase // Embeddable embeddable = OrmFactory.eINSTANCE.createEmbeddable(); // ormResource().getEntityMappings().getEmbeddables().add(embeddable); // embeddable.setClassName("model.Foo"); -// assertTrue(entityMappings().xmlPersistentTypes().hasNext()); -// assertEquals("model.Foo", entityMappings().xmlPersistentTypes().next().getMapping().getClass_()); +// assertTrue(entityMappings().ormPersistentTypes().hasNext()); +// assertEquals("model.Foo", entityMappings().ormPersistentTypes().next().getMapping().getClass_()); // assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); // assertTrue(ormResource().getEntityMappings().getEntities().isEmpty()); // assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty()); @@ -74,8 +74,8 @@ public class XmlPersistentTypeTests extends ContextModelTestCase // Entity entity = OrmFactory.eINSTANCE.createEntity(); // ormResource().getEntityMappings().getEntities().add(entity); // entity.setClassName("model.Foo2"); -// assertTrue(entityMappings().xmlPersistentTypes().hasNext()); -// assertEquals("model.Foo2", entityMappings().xmlPersistentTypes().next().getMapping().getClass_()); +// assertTrue(entityMappings().ormPersistentTypes().hasNext()); +// assertEquals("model.Foo2", entityMappings().ormPersistentTypes().next().getMapping().getClass_()); // assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); // assertFalse(ormResource().getEntityMappings().getEntities().isEmpty()); // assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty()); @@ -85,8 +85,8 @@ public class XmlPersistentTypeTests extends ContextModelTestCase // MappedSuperclass mappedSuperclass = OrmFactory.eINSTANCE.createMappedSuperclass(); // ormResource().getEntityMappings().getMappedSuperclasses().add(mappedSuperclass); // mappedSuperclass.setClassName("model.Foo3"); -// assertTrue(entityMappings().xmlPersistentTypes().hasNext()); -// assertEquals("model.Foo3", entityMappings().xmlPersistentTypes().next().getMapping().getClass_()); +// assertTrue(entityMappings().ormPersistentTypes().hasNext()); +// assertEquals("model.Foo3", entityMappings().ormPersistentTypes().next().getMapping().getClass_()); // assertFalse(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); // assertFalse(ormResource().getEntityMappings().getEntities().isEmpty()); // assertFalse(ormResource().getEntityMappings().getEmbeddables().isEmpty()); @@ -95,72 +95,72 @@ public class XmlPersistentTypeTests extends ContextModelTestCase // public void testMorphXmlTypeMapping() throws Exception { - assertFalse(entityMappings().xmlPersistentTypes().hasNext()); + assertFalse(entityMappings().ormPersistentTypes().hasNext()); assertTrue(ormResource().getEntityMappings().getMappedSuperclasses().isEmpty()); assertTrue(ormResource().getEntityMappings().getEntities().isEmpty()); assertTrue(ormResource().getEntityMappings().getEmbeddables().isEmpty()); - XmlPersistentType embeddablePersistentType = entityMappings().addXmlPersistentType(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - XmlPersistentType mappedSuperclassPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo3"); + OrmPersistentType embeddablePersistentType = entityMappings().addOrmPersistentType(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + OrmPersistentType mappedSuperclassPersistentType = entityMappings().addOrmPersistentType(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, "model.Foo3"); ormResource().save(null); - XmlPersistentType xmlPersistentType = entityMappings().xmlPersistentTypes().next(); - assertEquals(mappedSuperclassPersistentType, xmlPersistentType); - assertEquals(IMappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, xmlPersistentType.getMapping().getKey()); + OrmPersistentType ormPersistentType = entityMappings().ormPersistentTypes().next(); + assertEquals(mappedSuperclassPersistentType, ormPersistentType); + assertEquals(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY, ormPersistentType.getMapping().getKey()); - xmlPersistentType.setMappingKey(IMappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); + ormPersistentType.setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY); ormResource().save(null); assertEquals(0, ormResource().getEntityMappings().getMappedSuperclasses().size()); assertEquals(1, ormResource().getEntityMappings().getEntities().size()); assertEquals(2, ormResource().getEntityMappings().getEmbeddables().size()); - Iterator<XmlPersistentType> xmlPersistentTypes = entityMappings().xmlPersistentTypes(); - //the same XmlPersistentTypes should still be in the context model - assertEquals(xmlPersistentTypes.next(), entityPersistentType); - assertEquals(xmlPersistentTypes.next(), embeddablePersistentType); - assertEquals(xmlPersistentTypes.next(), mappedSuperclassPersistentType); + Iterator<OrmPersistentType> ormPersistentTypes = entityMappings().ormPersistentTypes(); + //the same OrmPersistentTypes should still be in the context model + assertEquals(ormPersistentTypes.next(), entityPersistentType); + assertEquals(ormPersistentTypes.next(), embeddablePersistentType); + assertEquals(ormPersistentTypes.next(), mappedSuperclassPersistentType); assertEquals("model.Foo", ormResource().getEntityMappings().getEmbeddables().get(0).getClassName()); assertEquals("model.Foo3", ormResource().getEntityMappings().getEmbeddables().get(1).getClassName()); } public void testAddSpecifiedPersistentAttribute() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute"); ormResource().save(null); - Entity entity = ormResource().getEntityMappings().getEntities().get(0); - Basic basic = entity.getAttributes().getBasics().get(0); + XmlEntity entity = ormResource().getEntityMappings().getEntities().get(0); + XmlBasic basic = entity.getAttributes().getBasics().get(0); assertEquals("basicAttribute", basic.getName()); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute"); ormResource().save(null); - Embedded embedded = entity.getAttributes().getEmbeddeds().get(0); + XmlEmbedded embedded = entity.getAttributes().getEmbeddeds().get(0); assertEquals("embeddedAttribute", embedded.getName()); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute"); ormResource().save(null); - Transient transientResource = entity.getAttributes().getTransients().get(0); + XmlTransient transientResource = entity.getAttributes().getTransients().get(0); assertEquals("transientAttribute", transientResource.getName()); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute"); ormResource().save(null); - Version version = entity.getAttributes().getVersions().get(0); + XmlVersion version = entity.getAttributes().getVersions().get(0); assertEquals("versionAttribute", version.getName()); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute"); ormResource().save(null); - Id id = entity.getAttributes().getIds().get(0); + XmlId id = entity.getAttributes().getIds().get(0); assertEquals("idAttribute", id.getName()); - ListIterator<XmlPersistentAttribute> persistentAttributes = entityPersistentType.specifiedAttributes(); + ListIterator<OrmPersistentAttribute> persistentAttributes = entityPersistentType.specifiedAttributes(); assertEquals("idAttribute", persistentAttributes.next().getName()); assertEquals("basicAttribute", persistentAttributes.next().getName()); assertEquals("versionAttribute", persistentAttributes.next().getName()); @@ -170,16 +170,16 @@ public class XmlPersistentTypeTests extends ContextModelTestCase } public void testRemoveSpecifiedPersistentAttribute() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute"); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute"); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute"); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute"); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute"); ormResource().save(null); - Entity entity = ormResource().getEntityMappings().getEntities().get(0); + XmlEntity entity = ormResource().getEntityMappings().getEntities().get(0); assertEquals("basicAttribute", entity.getAttributes().getBasics().get(0).getName()); assertEquals("embeddedAttribute", entity.getAttributes().getEmbeddeds().get(0).getName()); assertEquals("versionAttribute", entity.getAttributes().getVersions().get(0).getName()); @@ -209,10 +209,10 @@ public class XmlPersistentTypeTests extends ContextModelTestCase } public void testRemoveId() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - Entity entity = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + XmlEntity entity = ormResource().getEntityMappings().getEntities().get(0); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, "idAttribute"); assertEquals("idAttribute", entity.getAttributes().getIds().get(0).getName()); entityPersistentType.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("idAttribute")); @@ -220,10 +220,10 @@ public class XmlPersistentTypeTests extends ContextModelTestCase } public void testRemoveBasic() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - Entity entity = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + XmlEntity entity = ormResource().getEntityMappings().getEntities().get(0); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, "basicAttribute"); assertEquals("basicAttribute", entity.getAttributes().getBasics().get(0).getName()); entityPersistentType.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("basicAttribute")); @@ -231,10 +231,10 @@ public class XmlPersistentTypeTests extends ContextModelTestCase } public void testRemoveVersion() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - Entity entity = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + XmlEntity entity = ormResource().getEntityMappings().getEntities().get(0); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionAttribute"); assertEquals("versionAttribute", entity.getAttributes().getVersions().get(0).getName()); entityPersistentType.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("versionAttribute")); @@ -242,10 +242,10 @@ public class XmlPersistentTypeTests extends ContextModelTestCase } public void testRemoveEmbedded() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - Entity entity = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + XmlEntity entity = ormResource().getEntityMappings().getEntities().get(0); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, "embeddedAttribute"); assertEquals("embeddedAttribute", entity.getAttributes().getEmbeddeds().get(0).getName()); entityPersistentType.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("embeddedAttribute")); @@ -253,10 +253,10 @@ public class XmlPersistentTypeTests extends ContextModelTestCase } public void testRemoveTransient() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - Entity entity = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + XmlEntity entity = ormResource().getEntityMappings().getEntities().get(0); - entityPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute"); + entityPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientAttribute"); assertEquals("transientAttribute", entity.getAttributes().getTransients().get(0).getName()); entityPersistentType.removeSpecifiedXmlPersistentAttribute(entityPersistentType.attributeNamed("transientAttribute")); @@ -264,29 +264,29 @@ public class XmlPersistentTypeTests extends ContextModelTestCase } public void testUpdateSpecifiedPersistentAttributes() throws Exception { - XmlPersistentType entityPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); - Entity entity = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType entityPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo2"); + XmlEntity entity = ormResource().getEntityMappings().getEntities().get(0); entity.setAttributes(OrmFactory.eINSTANCE.createAttributes()); BasicImpl basic = OrmFactory.eINSTANCE.createBasicImpl(); entity.getAttributes().getBasics().add(basic); basic.setName("basicAttribute"); - XmlPersistentAttribute xmlPersistentAttribute = entityPersistentType.attributes().next(); + OrmPersistentAttribute xmlPersistentAttribute = entityPersistentType.attributes().next(); assertEquals("basicAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); EmbeddedImpl embedded = OrmFactory.eINSTANCE.createEmbeddedImpl(); entity.getAttributes().getEmbeddeds().add(embedded); embedded.setName("embeddedAttribute"); - ListIterator<XmlPersistentAttribute> attributes = entityPersistentType.attributes(); + ListIterator<OrmPersistentAttribute> attributes = entityPersistentType.attributes(); xmlPersistentAttribute = attributes.next(); assertEquals("basicAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("embeddedAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); assertFalse(attributes.hasNext()); VersionImpl version = OrmFactory.eINSTANCE.createVersionImpl(); @@ -296,13 +296,13 @@ public class XmlPersistentTypeTests extends ContextModelTestCase attributes = entityPersistentType.attributes(); xmlPersistentAttribute = attributes.next(); assertEquals("basicAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("versionAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("embeddedAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); assertFalse(attributes.hasNext()); IdImpl id = OrmFactory.eINSTANCE.createIdImpl(); @@ -312,16 +312,16 @@ public class XmlPersistentTypeTests extends ContextModelTestCase attributes = entityPersistentType.attributes(); xmlPersistentAttribute = attributes.next(); assertEquals("idAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("basicAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("versionAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("embeddedAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); assertFalse(attributes.hasNext()); TransientImpl transientResource = OrmFactory.eINSTANCE.createTransientImpl(); @@ -331,19 +331,19 @@ public class XmlPersistentTypeTests extends ContextModelTestCase attributes = entityPersistentType.attributes(); xmlPersistentAttribute = attributes.next(); assertEquals("idAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("basicAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("versionAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("embeddedAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("transientAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); assertFalse(attributes.hasNext()); ManyToOneImpl manyToOneResource = OrmFactory.eINSTANCE.createManyToOneImpl(); @@ -353,22 +353,22 @@ public class XmlPersistentTypeTests extends ContextModelTestCase attributes = entityPersistentType.attributes(); xmlPersistentAttribute = attributes.next(); assertEquals("idAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("basicAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("versionAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("manyToOneAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("embeddedAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("transientAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); assertFalse(attributes.hasNext()); ManyToManyImpl manyToManyResource = OrmFactory.eINSTANCE.createManyToManyImpl(); @@ -378,25 +378,25 @@ public class XmlPersistentTypeTests extends ContextModelTestCase attributes = entityPersistentType.attributes(); xmlPersistentAttribute = attributes.next(); assertEquals("idAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("basicAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("versionAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("manyToOneAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("manyToManyAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("embeddedAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("transientAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); assertFalse(attributes.hasNext()); OneToManyImpl oneToManyResource = OrmFactory.eINSTANCE.createOneToManyImpl(); @@ -406,28 +406,28 @@ public class XmlPersistentTypeTests extends ContextModelTestCase attributes = entityPersistentType.attributes(); xmlPersistentAttribute = attributes.next(); assertEquals("idAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("basicAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("versionAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("manyToOneAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("oneToManyAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("manyToManyAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("embeddedAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("transientAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); assertFalse(attributes.hasNext()); OneToOneImpl oneToOneResource = OrmFactory.eINSTANCE.createOneToOneImpl(); @@ -437,31 +437,31 @@ public class XmlPersistentTypeTests extends ContextModelTestCase attributes = entityPersistentType.attributes(); xmlPersistentAttribute = attributes.next(); assertEquals("idAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("basicAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("versionAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("manyToOneAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("oneToManyAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("oneToOneAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("manyToManyAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("embeddedAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("transientAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); assertFalse(attributes.hasNext()); @@ -472,34 +472,34 @@ public class XmlPersistentTypeTests extends ContextModelTestCase attributes = entityPersistentType.attributes(); xmlPersistentAttribute = attributes.next(); assertEquals("idAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("embeddedIdAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("basicAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("versionAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("manyToOneAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("oneToManyAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("oneToOneAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("manyToManyAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("embeddedAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); xmlPersistentAttribute = attributes.next(); assertEquals("transientAttribute", xmlPersistentAttribute.getName()); - assertEquals(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); + assertEquals(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, xmlPersistentAttribute.getMapping().getKey()); assertFalse(attributes.hasNext()); entity.getAttributes().getBasics().remove(0); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPrimaryKeyJoinColumnTests.java index 1a04472bb5..01bb5ebaf1 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPrimaryKeyJoinColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlPrimaryKeyJoinColumnTests.java @@ -12,16 +12,16 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.orm.XmlPrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.Entity; -import org.eclipse.jpt.core.internal.resource.orm.PrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmPrimaryKeyJoinColumn; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlEntity; +import org.eclipse.jpt.core.resource.orm.XmlPrimaryKeyJoinColumn; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -88,12 +88,12 @@ public class XmlPrimaryKeyJoinColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - PrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlPrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0); assertNull(xmlPrimaryKeyJoinColumn.getSpecifiedName()); assertNull(primaryKeyJoinColumnResource.getName()); @@ -121,12 +121,12 @@ public class XmlPrimaryKeyJoinColumnTests extends ContextModelTestCase } public void testModifySpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - PrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlPrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0); assertNull(xmlPrimaryKeyJoinColumn.getSpecifiedName()); assertNull(primaryKeyJoinColumnResource.getName()); @@ -143,12 +143,12 @@ public class XmlPrimaryKeyJoinColumnTests extends ContextModelTestCase } public void testUpdateSpecifiedReferencedColumnName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - PrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlPrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0); assertNull(xmlPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName()); assertNull(primaryKeyJoinColumnResource.getReferencedColumnName()); @@ -174,12 +174,12 @@ public class XmlPrimaryKeyJoinColumnTests extends ContextModelTestCase } public void testModifySpecifiedReferencedColumnName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - PrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlPrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0); assertNull(xmlPrimaryKeyJoinColumn.getSpecifiedReferencedColumnName()); assertNull(primaryKeyJoinColumnResource.getReferencedColumnName()); @@ -198,8 +198,8 @@ public class XmlPrimaryKeyJoinColumnTests extends ContextModelTestCase // public void testUpdateDefaultNameFromJavaTable() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName()); // // xmlEntity.javaEntity().getTable().setSpecifiedName("Foo"); @@ -225,8 +225,8 @@ public class XmlPrimaryKeyJoinColumnTests extends ContextModelTestCase // public void testUpdateDefaultNameNoJava() throws Exception { // createTestEntity(); // -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // assertEquals("Foo", xmlEntity.getTable().getDefaultName()); // } // @@ -234,10 +234,10 @@ public class XmlPrimaryKeyJoinColumnTests extends ContextModelTestCase // createTestEntity(); // createTestSubType(); // -// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); -// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); -// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping(); -// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping(); +// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); +// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); +// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping(); +// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping(); // // assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName()); // assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName()); @@ -253,12 +253,12 @@ public class XmlPrimaryKeyJoinColumnTests extends ContextModelTestCase public void testUpdateSpecifiedColumnDefinition() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - PrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlPrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0); assertNull(xmlPrimaryKeyJoinColumn.getColumnDefinition()); assertNull(primaryKeyJoinColumnResource.getColumnDefinition()); @@ -283,12 +283,12 @@ public class XmlPrimaryKeyJoinColumnTests extends ContextModelTestCase } public void testModifySpecifiedColumnDefinition() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmPrimaryKeyJoinColumn xmlPrimaryKeyJoinColumn = xmlEntity.addSpecifiedPrimaryKeyJoinColumn(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - PrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlPrimaryKeyJoinColumn primaryKeyJoinColumnResource = entityResource.getPrimaryKeyJoinColumns().get(0); assertNull(xmlPrimaryKeyJoinColumn.getColumnDefinition()); assertNull(primaryKeyJoinColumnResource.getColumnDefinition()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlQueryHintTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlQueryHintTests.java index ea6a41e786..f47206a7fa 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlQueryHintTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlQueryHintTests.java @@ -10,14 +10,14 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.orm; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.orm.XmlQueryHint; -import org.eclipse.jpt.core.internal.resource.orm.QueryHint; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmQueryHint; +import org.eclipse.jpt.core.resource.orm.XmlQueryHint; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class XmlQueryHintTests extends ContextModelTestCase @@ -37,11 +37,11 @@ public class XmlQueryHintTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlQueryHint xmlQueryHint = xmlEntity.addNamedQuery(0).addHint(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmQueryHint xmlQueryHint = xmlEntity.addNamedQuery(0).addHint(0); - QueryHint queryHintResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0); + XmlQueryHint queryHintResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0); assertNull(xmlQueryHint.getName()); assertNull(queryHintResource.getName()); @@ -58,11 +58,11 @@ public class XmlQueryHintTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlQueryHint xmlQueryHint = xmlEntity.addNamedQuery(0).addHint(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmQueryHint xmlQueryHint = xmlEntity.addNamedQuery(0).addHint(0); - QueryHint queryHintResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0); + XmlQueryHint queryHintResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0); assertNull(xmlQueryHint.getName()); assertNull(queryHintResource.getName()); @@ -79,11 +79,11 @@ public class XmlQueryHintTests extends ContextModelTestCase } public void testUpdateValue() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlQueryHint xmlQueryHint = xmlEntity.addNamedQuery(0).addHint(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmQueryHint xmlQueryHint = xmlEntity.addNamedQuery(0).addHint(0); - QueryHint queryHintResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0); + XmlQueryHint queryHintResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0); assertNull(xmlQueryHint.getValue()); assertNull(queryHintResource.getValue()); @@ -100,11 +100,11 @@ public class XmlQueryHintTests extends ContextModelTestCase } public void testModifyValue() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlQueryHint xmlQueryHint = xmlEntity.addNamedQuery(0).addHint(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmQueryHint xmlQueryHint = xmlEntity.addNamedQuery(0).addHint(0); - QueryHint queryHintResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0); + XmlQueryHint queryHintResource = ormResource().getEntityMappings().getEntities().get(0).getNamedQueries().get(0).getHints().get(0); assertNull(xmlQueryHint.getValue()); assertNull(queryHintResource.getValue()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSecondaryTableTests.java index c716e9daf0..6cc7d4c8ed 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSecondaryTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSecondaryTableTests.java @@ -13,19 +13,19 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.ISecondaryTable; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.orm.XmlPrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlSecondaryTable; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.Entity; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.orm.SecondaryTable; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.SecondaryTable; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmPrimaryKeyJoinColumn; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmSecondaryTable; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlEntity; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.orm.XmlSecondaryTable; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -92,14 +92,14 @@ public class XmlSecondaryTableTests extends ContextModelTestCase } public void testUpdateSpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); //set name in the resource model, verify context model updated entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createSecondaryTable()); entityResource.getSecondaryTables().get(0).setName("FOO"); - XmlSecondaryTable secondaryTable = xmlEntity.specifiedSecondaryTables().next(); + GenericOrmSecondaryTable secondaryTable = xmlEntity.specifiedSecondaryTables().next(); assertEquals("FOO", secondaryTable.getSpecifiedName()); assertEquals("FOO", entityResource.getSecondaryTables().get(0).getName()); @@ -114,12 +114,12 @@ public class XmlSecondaryTableTests extends ContextModelTestCase } public void testModifySpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); //set name in the context model, verify resource model modified - XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + GenericOrmSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); secondaryTable.setSpecifiedName("foo"); assertEquals("foo", secondaryTable.getSpecifiedName()); @@ -138,24 +138,24 @@ public class XmlSecondaryTableTests extends ContextModelTestCase public void testUpdateDefaultNameFromJavaTable() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); xmlEntity.javaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("FOO"); - XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + GenericOrmSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); secondaryTable.setSpecifiedName("FOO"); assertNull(secondaryTable.getDefaultName()); } public void testUpdateSpecifiedSchema() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); //set schema in the resource model, verify context model updated entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createSecondaryTable()); entityResource.getSecondaryTables().get(0).setSchema("FOO"); - XmlSecondaryTable secondaryTable = xmlEntity.specifiedSecondaryTables().next(); + GenericOrmSecondaryTable secondaryTable = xmlEntity.specifiedSecondaryTables().next(); assertEquals("FOO", secondaryTable.getSpecifiedSchema()); assertEquals("FOO", entityResource.getSecondaryTables().get(0).getSchema()); @@ -170,12 +170,12 @@ public class XmlSecondaryTableTests extends ContextModelTestCase } public void testModifySpecifiedSchema() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); //set schema in the context model, verify resource model modified - XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + GenericOrmSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); secondaryTable.setSpecifiedSchema("foo"); assertEquals("foo", secondaryTable.getSpecifiedSchema()); @@ -194,14 +194,14 @@ public class XmlSecondaryTableTests extends ContextModelTestCase public void testUpdateDefaultSchemaFromJavaTable() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName()); - ISecondaryTable javaSecondaryTable = xmlEntity.javaEntity().addSpecifiedSecondaryTable(0); + SecondaryTable javaSecondaryTable = xmlEntity.javaEntity().addSpecifiedSecondaryTable(0); javaSecondaryTable.setSpecifiedName("FOO"); javaSecondaryTable.setSpecifiedSchema("BAR"); - XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + GenericOrmSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); secondaryTable.setSpecifiedName("FOO"); assertNull(secondaryTable.getDefaultSchema()); } @@ -210,10 +210,10 @@ public class XmlSecondaryTableTests extends ContextModelTestCase // createTestEntity(); // createTestSubType(); // -// XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(FULLY_QUALIFIED_TYPE_NAME, IMappingKeys.ENTITY_TYPE_MAPPING_KEY); -// XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild", IMappingKeys.ENTITY_TYPE_MAPPING_KEY); -// XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping(); -// XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping(); +// OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(FULLY_QUALIFIED_TYPE_NAME, IMappingKeys.ENTITY_TYPE_MAPPING_KEY); +// OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild", IMappingKeys.ENTITY_TYPE_MAPPING_KEY); +// XmlEntity parentXmlEntity = (XmlEntity) parentOrmPersistentType.getMapping(); +// XmlEntity childXmlEntity = (XmlEntity) childOrmPersistentType.getMapping(); // // assertNull(parentXmlEntity.getTable().getDefaultSchema()); // assertNull(childXmlEntity.getTable().getDefaultSchema()); @@ -230,9 +230,9 @@ public class XmlSecondaryTableTests extends ContextModelTestCase public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); xmlSecondaryTable.setSpecifiedName("FOO"); assertNull(xmlSecondaryTable.getDefaultSchema()); @@ -242,7 +242,7 @@ public class XmlSecondaryTableTests extends ContextModelTestCase xmlEntity.entityMappings().setSpecifiedSchema("BAR"); assertEquals("BAR", xmlSecondaryTable.getDefaultSchema()); - ISecondaryTable javaSecondaryTable = xmlEntity.javaEntity().addSpecifiedSecondaryTable(0); + SecondaryTable javaSecondaryTable = xmlEntity.javaEntity().addSpecifiedSecondaryTable(0); javaSecondaryTable.setSpecifiedName("FOO"); javaSecondaryTable.setSpecifiedSchema("JAVA_SCHEMA"); assertEquals("BAR", xmlSecondaryTable.getDefaultSchema()); //schema is not defaulted from underlying java @@ -255,14 +255,14 @@ public class XmlSecondaryTableTests extends ContextModelTestCase } public void testUpdateSpecifiedCatalog() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); //set catalog in the resource model, verify context model updated entityResource.getSecondaryTables().add(OrmFactory.eINSTANCE.createSecondaryTable()); entityResource.getSecondaryTables().get(0).setCatalog("FOO"); - XmlSecondaryTable secondaryTable = xmlEntity.specifiedSecondaryTables().next(); + GenericOrmSecondaryTable secondaryTable = xmlEntity.specifiedSecondaryTables().next(); assertEquals("FOO", secondaryTable.getSpecifiedCatalog()); assertEquals("FOO", entityResource.getSecondaryTables().get(0).getCatalog()); @@ -277,12 +277,12 @@ public class XmlSecondaryTableTests extends ContextModelTestCase } public void testModifySpecifiedCatalog() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); //set catalog in the context model, verify resource model modified - XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + GenericOrmSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); secondaryTable.setSpecifiedCatalog("foo"); assertEquals("foo", secondaryTable.getSpecifiedCatalog()); @@ -301,14 +301,14 @@ public class XmlSecondaryTableTests extends ContextModelTestCase public void testUpdateDefaultCatalogFromJavaTable() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName()); - ISecondaryTable javaSecondaryTable = xmlEntity.javaEntity().addSpecifiedSecondaryTable(0); + SecondaryTable javaSecondaryTable = xmlEntity.javaEntity().addSpecifiedSecondaryTable(0); javaSecondaryTable.setSpecifiedName("FOO"); javaSecondaryTable.setSpecifiedCatalog("BAR"); - XmlSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + GenericOrmSecondaryTable secondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); secondaryTable.setSpecifiedName("FOO"); assertNull(secondaryTable.getDefaultCatalog()); } @@ -316,9 +316,9 @@ public class XmlSecondaryTableTests extends ContextModelTestCase public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); xmlSecondaryTable.setSpecifiedName("FOO"); assertNull(xmlSecondaryTable.getDefaultCatalog()); @@ -328,7 +328,7 @@ public class XmlSecondaryTableTests extends ContextModelTestCase xmlEntity.entityMappings().setSpecifiedCatalog("BAR"); assertEquals("BAR", xmlSecondaryTable.getDefaultCatalog()); - ISecondaryTable javaSecondaryTable = xmlEntity.javaEntity().addSpecifiedSecondaryTable(0); + SecondaryTable javaSecondaryTable = xmlEntity.javaEntity().addSpecifiedSecondaryTable(0); javaSecondaryTable.setSpecifiedName("FOO"); javaSecondaryTable.setSpecifiedCatalog("JAVA_CATALOG"); assertEquals("BAR", xmlSecondaryTable.getDefaultCatalog()); //schema is not defaulted from underlying java @@ -341,20 +341,20 @@ public class XmlSecondaryTableTests extends ContextModelTestCase } public void testAddSpecifiedPrimaryKeyJoinColumn() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); - XmlSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - SecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); + GenericOrmSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0); - XmlPrimaryKeyJoinColumn primaryKeyJoinColumn = xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0); + GenericOrmPrimaryKeyJoinColumn primaryKeyJoinColumn = xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0); ormResource().save(null); primaryKeyJoinColumn.setSpecifiedName("FOO"); ormResource().save(null); assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName()); - XmlPrimaryKeyJoinColumn primaryKeyJoinColumn2 = xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0); + GenericOrmPrimaryKeyJoinColumn primaryKeyJoinColumn2 = xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0); ormResource().save(null); primaryKeyJoinColumn2.setSpecifiedName("BAR"); ormResource().save(null); @@ -362,7 +362,7 @@ public class XmlSecondaryTableTests extends ContextModelTestCase assertEquals("BAR", secondaryTableResource.getPrimaryKeyJoinColumns().get(0).getName()); assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(1).getName()); - XmlPrimaryKeyJoinColumn primaryKeyJoinColumn3 = xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(1); + GenericOrmPrimaryKeyJoinColumn primaryKeyJoinColumn3 = xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(1); ormResource().save(null); primaryKeyJoinColumn3.setSpecifiedName("BAZ"); ormResource().save(null); @@ -371,7 +371,7 @@ public class XmlSecondaryTableTests extends ContextModelTestCase assertEquals("BAZ", secondaryTableResource.getPrimaryKeyJoinColumns().get(1).getName()); assertEquals("FOO", secondaryTableResource.getPrimaryKeyJoinColumns().get(2).getName()); - ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns(); + ListIterator<GenericOrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns(); assertEquals(primaryKeyJoinColumn2, primaryKeyJoinColumns.next()); assertEquals(primaryKeyJoinColumn3, primaryKeyJoinColumns.next()); assertEquals(primaryKeyJoinColumn, primaryKeyJoinColumns.next()); @@ -383,11 +383,11 @@ public class XmlSecondaryTableTests extends ContextModelTestCase } public void testRemoveSpecifiedPrimaryKeyJoinColumn() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); - XmlSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - SecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); + GenericOrmSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0); xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO"); xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR"); @@ -409,11 +409,11 @@ public class XmlSecondaryTableTests extends ContextModelTestCase } public void testMoveSpecifiedPrimaryKeyJoinColumn() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); - XmlSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - SecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); + GenericOrmSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0); xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO"); xmlSecondaryTable.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR"); @@ -423,7 +423,7 @@ public class XmlSecondaryTableTests extends ContextModelTestCase xmlSecondaryTable.moveSpecifiedPrimaryKeyJoinColumn(2, 0); - ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns(); + ListIterator<GenericOrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns(); assertEquals("BAR", primaryKeyJoinColumns.next().getName()); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); @@ -445,11 +445,11 @@ public class XmlSecondaryTableTests extends ContextModelTestCase } public void testUpdatePrimaryKeyJoinColumns() throws Exception { - XmlPersistentType persistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) persistentType.getMapping(); - XmlSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); - SecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0); + OrmPersistentType persistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) persistentType.getMapping(); + GenericOrmSecondaryTable xmlSecondaryTable = xmlEntity.addSpecifiedSecondaryTable(0); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); + XmlSecondaryTable secondaryTableResource = entityResource.getSecondaryTables().get(0); secondaryTableResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn()); secondaryTableResource.getPrimaryKeyJoinColumns().add(OrmFactory.eINSTANCE.createPrimaryKeyJoinColumn()); @@ -459,7 +459,7 @@ public class XmlSecondaryTableTests extends ContextModelTestCase secondaryTableResource.getPrimaryKeyJoinColumns().get(1).setName("BAR"); secondaryTableResource.getPrimaryKeyJoinColumns().get(2).setName("BAZ"); - ListIterator<XmlPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns(); + ListIterator<GenericOrmPrimaryKeyJoinColumn> primaryKeyJoinColumns = xmlSecondaryTable.specifiedPrimaryKeyJoinColumns(); assertEquals("FOO", primaryKeyJoinColumns.next().getName()); assertEquals("BAR", primaryKeyJoinColumns.next().getName()); assertEquals("BAZ", primaryKeyJoinColumns.next().getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSequenceGeneratorTests.java index d646674d24..b608603052 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSequenceGeneratorTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlSequenceGeneratorTests.java @@ -12,12 +12,12 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.ISequenceGenerator; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.SequenceGenerator; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.context.SequenceGenerator; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlSequenceGenerator; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -84,8 +84,8 @@ public class XmlSequenceGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedName() throws Exception { - ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); - SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); + SequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); + XmlSequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); //set name in the resource model, verify context model updated sequenceGeneratorResource.setName("FOO"); @@ -99,8 +99,8 @@ public class XmlSequenceGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedName() throws Exception { - ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); - SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); + SequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); + XmlSequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); //set name in the context model, verify resource model modified sequenceGenerator.setName("FOO"); @@ -114,8 +114,8 @@ public class XmlSequenceGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedSequenceName() throws Exception { - ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); - SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); + SequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); + XmlSequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); //set name in the resource model, verify context model updated sequenceGeneratorResource.setSequenceName("FOO"); @@ -129,8 +129,8 @@ public class XmlSequenceGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedSequenceName() throws Exception { - ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); - SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); + SequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); + XmlSequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); //set name in the context model, verify resource model modified sequenceGenerator.setSpecifiedSequenceName("FOO"); @@ -144,8 +144,8 @@ public class XmlSequenceGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedInitialValue() throws Exception { - ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); - SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); + SequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); + XmlSequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); //set initial value in the resource model, verify context model updated sequenceGeneratorResource.setInitialValue(Integer.valueOf(10)); @@ -164,8 +164,8 @@ public class XmlSequenceGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedInitialValue() throws Exception { - ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); - SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); + SequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); + XmlSequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); //set initial value in the context model, verify resource model modified sequenceGenerator.setSpecifiedInitialValue(Integer.valueOf(10)); @@ -183,8 +183,8 @@ public class XmlSequenceGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedAllocationSize() throws Exception { - ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); - SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); + SequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); + XmlSequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); //set allocation size in the resource model, verify context model updated sequenceGeneratorResource.setAllocationSize(Integer.valueOf(10)); @@ -203,8 +203,8 @@ public class XmlSequenceGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedAllocationSize() throws Exception { - ISequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); - SequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); + SequenceGenerator sequenceGenerator = entityMappings().addSequenceGenerator(0); + XmlSequenceGenerator sequenceGeneratorResource = ormResource().getEntityMappings().getSequenceGenerators().get(0); //set allocation size in the context model, verify resource model modified sequenceGenerator.setSpecifiedAllocationSize(Integer.valueOf(10)); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableGeneratorTests.java index 05c366c748..c545cae4df 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableGeneratorTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableGeneratorTests.java @@ -12,12 +12,12 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.ITableGenerator; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.TableGenerator; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.context.TableGenerator; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlTableGenerator; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -84,8 +84,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedName() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the resource model, verify context model updated tableGeneratorResource.setName("FOO"); @@ -99,8 +99,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedName() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the context model, verify resource model modified tableGenerator.setName("FOO"); @@ -114,8 +114,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedInitialValue() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set initial value in the resource model, verify context model updated tableGeneratorResource.setInitialValue(Integer.valueOf(10)); @@ -134,8 +134,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedInitialValue() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set initial value in the context model, verify resource model modified tableGenerator.setSpecifiedInitialValue(Integer.valueOf(10)); @@ -153,8 +153,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedAllocationSize() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set allocation size in the resource model, verify context model updated tableGeneratorResource.setAllocationSize(Integer.valueOf(10)); @@ -173,8 +173,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedAllocationSize() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set allocation size in the context model, verify resource model modified tableGenerator.setSpecifiedAllocationSize(Integer.valueOf(10)); @@ -192,8 +192,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedTable() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the resource model, verify context model updated tableGeneratorResource.setTable("FOO"); @@ -207,8 +207,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedTable() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the context model, verify resource model modified tableGenerator.setSpecifiedTable("FOO"); @@ -222,8 +222,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedSchema() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the resource model, verify context model updated tableGeneratorResource.setSchema("FOO"); @@ -237,8 +237,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedSchema() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the context model, verify resource model modified tableGenerator.setSpecifiedSchema("FOO"); @@ -252,8 +252,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedCatalog() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the resource model, verify context model updated tableGeneratorResource.setCatalog("FOO"); @@ -267,8 +267,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedCatalog() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the context model, verify resource model modified tableGenerator.setSpecifiedCatalog("FOO"); @@ -282,8 +282,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedPkColumnName() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the resource model, verify context model updated tableGeneratorResource.setPkColumnName("FOO"); @@ -297,8 +297,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedPkColumnName() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the context model, verify resource model modified tableGenerator.setSpecifiedPkColumnName("FOO"); @@ -312,8 +312,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedValueColumnName() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the resource model, verify context model updated tableGeneratorResource.setValueColumnName("FOO"); @@ -327,8 +327,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedValueColumnName() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the context model, verify resource model modified tableGenerator.setSpecifiedValueColumnName("FOO"); @@ -342,8 +342,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testUpdateSpecifiedPkColumnValue() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the resource model, verify context model updated tableGeneratorResource.setPkColumnValue("FOO"); @@ -357,8 +357,8 @@ public class XmlTableGeneratorTests extends ContextModelTestCase } public void testModifySpecifiedPkColumnValue() throws Exception { - ITableGenerator tableGenerator = entityMappings().addTableGenerator(0); - TableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); + TableGenerator tableGenerator = entityMappings().addTableGenerator(0); + XmlTableGenerator tableGeneratorResource = ormResource().getEntityMappings().getTableGenerators().get(0); //set name in the context model, verify resource model modified tableGenerator.setSpecifiedPkColumnValue("FOO"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableTests.java index b9d0d393a3..a446b6b5dc 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTableTests.java @@ -12,17 +12,17 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.InheritanceType; -import org.eclipse.jpt.core.internal.context.orm.XmlEntity; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.orm.XmlTable; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.Entity; -import org.eclipse.jpt.core.internal.resource.orm.OrmFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.InheritanceType; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmTable; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlEntity; +import org.eclipse.jpt.core.resource.orm.OrmFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject.SourceWriter; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -89,10 +89,10 @@ public class XmlTableTests extends ContextModelTestCase } public void testUpdateSpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlTable xmlTable = xmlEntity.getTable(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmTable xmlTable = xmlEntity.getTable(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlTable.getSpecifiedName()); assertNull(entityResource.getTable()); @@ -117,9 +117,9 @@ public class XmlTableTests extends ContextModelTestCase } public void testModifySpecifiedName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlTable xmlTable = ((XmlEntity) xmlPersistentType.getMapping()).getTable(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmTable xmlTable = ((GenericOrmEntity) ormPersistentType.getMapping()).getTable(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlTable.getSpecifiedName()); assertNull(entityResource.getTable()); @@ -137,8 +137,8 @@ public class XmlTableTests extends ContextModelTestCase public void testUpdateDefaultNameFromJavaTable() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertEquals(TYPE_NAME, xmlEntity.getTable().getDefaultName()); xmlEntity.javaEntity().getTable().setSpecifiedName("Foo"); @@ -164,8 +164,8 @@ public class XmlTableTests extends ContextModelTestCase public void testUpdateDefaultNameNoJava() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertEquals("Foo", xmlEntity.getTable().getDefaultName()); } @@ -173,10 +173,10 @@ public class XmlTableTests extends ContextModelTestCase createTestEntity(); createTestSubType(); - XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); - XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping(); - XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping(); + OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); + GenericOrmEntity parentXmlEntity = (GenericOrmEntity) parentOrmPersistentType.getMapping(); + GenericOrmEntity childXmlEntity = (GenericOrmEntity) childOrmPersistentType.getMapping(); assertEquals(TYPE_NAME, parentXmlEntity.getTable().getDefaultName()); assertEquals(TYPE_NAME, childXmlEntity.getTable().getDefaultName()); @@ -191,10 +191,10 @@ public class XmlTableTests extends ContextModelTestCase } public void testUpdateSpecifiedSchema() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlTable xmlTable = xmlEntity.getTable(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmTable xmlTable = xmlEntity.getTable(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlTable.getSpecifiedSchema()); assertNull(entityResource.getTable()); @@ -221,8 +221,8 @@ public class XmlTableTests extends ContextModelTestCase public void testUpdateDefaultSchemaFromJavaTable() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertNull(xmlEntity.getTable().getDefaultSchema()); xmlEntity.javaEntity().getTable().setSpecifiedSchema("Foo"); @@ -248,8 +248,8 @@ public class XmlTableTests extends ContextModelTestCase public void testUpdateDefaultSchemaNoJava() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertNull(xmlEntity.getTable().getDefaultSchema()); } @@ -257,10 +257,10 @@ public class XmlTableTests extends ContextModelTestCase createTestEntity(); createTestSubType(); - XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); - XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping(); - XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping(); + OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); + GenericOrmEntity parentXmlEntity = (GenericOrmEntity) parentOrmPersistentType.getMapping(); + GenericOrmEntity childXmlEntity = (GenericOrmEntity) childOrmPersistentType.getMapping(); assertNull(parentXmlEntity.getTable().getDefaultSchema()); assertNull(childXmlEntity.getTable().getDefaultSchema()); @@ -277,8 +277,8 @@ public class XmlTableTests extends ContextModelTestCase public void testUpdateDefaultSchemaFromPersistenceUnitDefaults() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertNull(xmlEntity.getTable().getDefaultSchema()); xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setSchema("FOO"); @@ -306,10 +306,10 @@ public class XmlTableTests extends ContextModelTestCase } public void testModifySpecifiedSchema() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlTable xmlTable = xmlEntity.getTable(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmTable xmlTable = xmlEntity.getTable(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlTable.getSpecifiedSchema()); assertNull(entityResource.getTable()); @@ -325,10 +325,10 @@ public class XmlTableTests extends ContextModelTestCase } public void testUpdateSpecifiedCatalog() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlTable xmlTable = xmlEntity.getTable(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmTable xmlTable = xmlEntity.getTable(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlTable.getSpecifiedCatalog()); assertNull(entityResource.getTable()); @@ -353,10 +353,10 @@ public class XmlTableTests extends ContextModelTestCase } public void testModifySpecifiedCatalog() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); - XmlTable xmlTable = xmlEntity.getTable(); - Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); + GenericOrmTable xmlTable = xmlEntity.getTable(); + XmlEntity entityResource = ormResource().getEntityMappings().getEntities().get(0); assertNull(xmlTable.getSpecifiedCatalog()); assertNull(entityResource.getTable()); @@ -374,8 +374,8 @@ public class XmlTableTests extends ContextModelTestCase public void testUpdateDefaultCatalogFromJavaTable() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertNull(xmlEntity.getTable().getDefaultCatalog()); xmlEntity.javaEntity().getTable().setSpecifiedCatalog("Foo"); @@ -401,8 +401,8 @@ public class XmlTableTests extends ContextModelTestCase public void testUpdateDefaultCatalogNoJava() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertNull(xmlEntity.getTable().getDefaultCatalog()); } @@ -410,10 +410,10 @@ public class XmlTableTests extends ContextModelTestCase createTestEntity(); createTestSubType(); - XmlPersistentType parentXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentType childXmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); - XmlEntity parentXmlEntity = (XmlEntity) parentXmlPersistentType.getMapping(); - XmlEntity childXmlEntity = (XmlEntity) childXmlPersistentType.getMapping(); + OrmPersistentType parentOrmPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentType childOrmPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".AnnotationTestTypeChild"); + GenericOrmEntity parentXmlEntity = (GenericOrmEntity) parentOrmPersistentType.getMapping(); + GenericOrmEntity childXmlEntity = (GenericOrmEntity) childOrmPersistentType.getMapping(); assertNull(parentXmlEntity.getTable().getDefaultCatalog()); assertNull(childXmlEntity.getTable().getDefaultCatalog()); @@ -430,8 +430,8 @@ public class XmlTableTests extends ContextModelTestCase public void testUpdateDefaultCatalogFromPersistenceUnitDefaults() throws Exception { createTestEntity(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + GenericOrmEntity xmlEntity = (GenericOrmEntity) ormPersistentType.getMapping(); assertNull(xmlEntity.getTable().getDefaultCatalog()); xmlEntity.entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setCatalog("FOO"); @@ -460,8 +460,8 @@ public class XmlTableTests extends ContextModelTestCase // // public void testUpdateName() throws Exception { -// XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); -// XmlEntity xmlEntity = (XmlEntity) xmlPersistentType.getMapping(); +// OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); +// XmlEntity xmlEntity = (XmlEntity) ormPersistentType.getMapping(); // Entity entityResource = ormResource().getEntityMappings().getEntities().get(0); // assertEquals("Foo", xmlEntity.getName()); // diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTransientMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTransientMappingTests.java index 034c894134..ba47c6f5cb 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTransientMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlTransientMappingTests.java @@ -12,24 +12,24 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.orm.XmlTransientMapping; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.Transient; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmTransientMapping; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlTransient; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -77,10 +77,10 @@ public class XmlTransientMappingTests extends ContextModelTestCase }); } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientMapping"); - XmlTransientMapping xmlTransientnMapping = (XmlTransientMapping) xmlPersistentAttribute.getMapping(); - Transient transientResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getTransients().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientMapping"); + GenericOrmTransientMapping xmlTransientnMapping = (GenericOrmTransientMapping) xmlPersistentAttribute.getMapping(); + XmlTransient transientResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getTransients().get(0); assertEquals("transientMapping", xmlTransientnMapping.getName()); assertEquals("transientMapping", transientResource.getName()); @@ -97,10 +97,10 @@ public class XmlTransientMappingTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientMapping"); - XmlTransientMapping xmlTransientnMapping = (XmlTransientMapping) xmlPersistentAttribute.getMapping(); - Transient transientResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getTransients().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transientMapping"); + GenericOrmTransientMapping xmlTransientnMapping = (GenericOrmTransientMapping) xmlPersistentAttribute.getMapping(); + XmlTransient transientResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getTransients().get(0); assertEquals("transientMapping", xmlTransientnMapping.getName()); assertEquals("transientMapping", transientResource.getName()); @@ -120,12 +120,12 @@ public class XmlTransientMappingTests extends ContextModelTestCase public void testTransientMappingNoUnderylingJavaAttribute() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "foo"); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "foo"); + assertEquals(2, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlTransientMapping xmlTransientMapping = (XmlTransientMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmTransientMapping xmlTransientMapping = (GenericOrmTransientMapping) xmlPersistentAttribute.getMapping(); assertEquals("foo", xmlTransientMapping.getName()); } @@ -139,170 +139,170 @@ public class XmlTransientMappingTests extends ContextModelTestCase //@Enumerated(EnumType.STRING) public void testVirtualMappingMetadataCompleteFalse() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + assertEquals(2, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlTransientMapping xmlTransientMapping = (XmlTransientMapping) xmlPersistentAttribute.getMapping(); + GenericOrmTransientMapping xmlTransientMapping = (GenericOrmTransientMapping) xmlPersistentAttribute.getMapping(); assertEquals("id", xmlTransientMapping.getName()); } public void testVirtualMappingMetadataCompleteTrue() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - xmlPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); + assertEquals(2, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlTransientMapping xmlTransientMapping = (XmlTransientMapping) xmlPersistentAttribute.getMapping(); + GenericOrmTransientMapping xmlTransientMapping = (GenericOrmTransientMapping) xmlPersistentAttribute.getMapping(); assertEquals("id", xmlTransientMapping.getName()); } public void testSpecifiedMapping() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "id"); - assertEquals(1, xmlPersistentType.virtualAttributesSize()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "id"); + assertEquals(1, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlTransientMapping xmlTransientMapping = (XmlTransientMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmTransientMapping xmlTransientMapping = (GenericOrmTransientMapping) xmlPersistentAttribute.getMapping(); assertEquals("id", xmlTransientMapping.getName()); } public void testTransientMorphToIdMapping() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); - ITransientMapping transientMapping = (ITransientMapping) xmlPersistentAttribute.getMapping(); + TransientMapping transientMapping = (TransientMapping) xmlPersistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof IdMapping); assertEquals("transient", xmlPersistentAttribute.getMapping().getName()); } public void testTransientMorphToVersionMapping() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); - ITransientMapping transientMapping = (ITransientMapping) xmlPersistentAttribute.getMapping(); + TransientMapping transientMapping = (TransientMapping) xmlPersistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IVersionMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof VersionMapping); assertEquals("transient", xmlPersistentAttribute.getMapping().getName()); } public void testTransientMorphToTransientMapping() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); - ITransientMapping transientMapping = (ITransientMapping) xmlPersistentAttribute.getMapping(); + TransientMapping transientMapping = (TransientMapping) xmlPersistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof ITransientMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof TransientMapping); assertEquals("transient", xmlPersistentAttribute.getMapping().getName()); } public void testTransientMorphToEmbeddedMapping() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); - ITransientMapping transientMapping = (ITransientMapping) xmlPersistentAttribute.getMapping(); + TransientMapping transientMapping = (TransientMapping) xmlPersistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedMapping); assertEquals("transient", xmlPersistentAttribute.getMapping().getName()); } public void testTransientMorphToEmbeddedIdMapping() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); - ITransientMapping transientMapping = (ITransientMapping) xmlPersistentAttribute.getMapping(); + TransientMapping transientMapping = (TransientMapping) xmlPersistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedIdMapping); assertEquals("transient", xmlPersistentAttribute.getMapping().getName()); } public void testTransientMorphToOneToOneMapping() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); - ITransientMapping transientMapping = (ITransientMapping) xmlPersistentAttribute.getMapping(); + TransientMapping transientMapping = (TransientMapping) xmlPersistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToOneMapping); assertEquals("transient", xmlPersistentAttribute.getMapping().getName()); } public void testTransientMorphToOneToManyMapping() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); - ITransientMapping transientMapping = (ITransientMapping) xmlPersistentAttribute.getMapping(); + TransientMapping transientMapping = (TransientMapping) xmlPersistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToManyMapping); assertEquals("transient", xmlPersistentAttribute.getMapping().getName()); } public void testTransientMorphToManyToOneMapping() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); - ITransientMapping transientMapping = (ITransientMapping) xmlPersistentAttribute.getMapping(); + TransientMapping transientMapping = (TransientMapping) xmlPersistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToOneMapping); assertEquals("transient", xmlPersistentAttribute.getMapping().getName()); } public void testTransientMorphToManyToManyMapping() throws Exception { createTestEntityTransientMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY, "transient"); - ITransientMapping transientMapping = (ITransientMapping) xmlPersistentAttribute.getMapping(); + TransientMapping transientMapping = (TransientMapping) xmlPersistentAttribute.getMapping(); assertFalse(transientMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToManyMapping); assertEquals("transient", xmlPersistentAttribute.getMapping().getName()); } }
\ No newline at end of file diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlVersionMappingTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlVersionMappingTests.java index 48f23d569f..01f7765fe8 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlVersionMappingTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/orm/XmlVersionMappingTests.java @@ -12,27 +12,27 @@ package org.eclipse.jpt.core.tests.internal.context.orm; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.IBasicMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedIdMapping; -import org.eclipse.jpt.core.internal.context.base.IEmbeddedMapping; -import org.eclipse.jpt.core.internal.context.base.IIdMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IManyToOneMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToManyMapping; -import org.eclipse.jpt.core.internal.context.base.IOneToOneMapping; -import org.eclipse.jpt.core.internal.context.base.ITransientMapping; -import org.eclipse.jpt.core.internal.context.base.IVersionMapping; -import org.eclipse.jpt.core.internal.context.base.TemporalType; -import org.eclipse.jpt.core.internal.context.orm.XmlColumn; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentAttribute; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.orm.XmlVersionMapping; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.Version; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.BasicMapping; +import org.eclipse.jpt.core.context.EmbeddedIdMapping; +import org.eclipse.jpt.core.context.EmbeddedMapping; +import org.eclipse.jpt.core.context.IdMapping; +import org.eclipse.jpt.core.context.ManyToManyMapping; +import org.eclipse.jpt.core.context.ManyToOneMapping; +import org.eclipse.jpt.core.context.OneToManyMapping; +import org.eclipse.jpt.core.context.OneToOneMapping; +import org.eclipse.jpt.core.context.TransientMapping; +import org.eclipse.jpt.core.context.VersionMapping; +import org.eclipse.jpt.core.context.TemporalType; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmColumn; +import org.eclipse.jpt.core.internal.context.orm.OrmPersistentAttribute; +import org.eclipse.jpt.core.internal.context.orm.GenericOrmVersionMapping; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.XmlVersion; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -104,10 +104,10 @@ public class XmlVersionMappingTests extends ContextModelTestCase } public void testUpdateName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping"); - XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping(); - Version versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping"); + GenericOrmVersionMapping xmlVersionMapping = (GenericOrmVersionMapping) xmlPersistentAttribute.getMapping(); + XmlVersion versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0); assertEquals("versionMapping", xmlVersionMapping.getName()); assertEquals("versionMapping", versionResource.getName()); @@ -124,10 +124,10 @@ public class XmlVersionMappingTests extends ContextModelTestCase } public void testModifyName() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping"); - XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping(); - Version versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping"); + GenericOrmVersionMapping xmlVersionMapping = (GenericOrmVersionMapping) xmlPersistentAttribute.getMapping(); + XmlVersion versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0); assertEquals("versionMapping", xmlVersionMapping.getName()); assertEquals("versionMapping", versionResource.getName()); @@ -144,30 +144,30 @@ public class XmlVersionMappingTests extends ContextModelTestCase } public void testUpdateTemporal() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping"); - XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping(); - Version versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping"); + GenericOrmVersionMapping xmlVersionMapping = (GenericOrmVersionMapping) xmlPersistentAttribute.getMapping(); + XmlVersion versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0); ormResource().save(null); assertNull(xmlVersionMapping.getTemporal()); assertNull(versionResource.getTemporal()); //set temporal in the resource model, verify context model updated - versionResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE); + versionResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.DATE); ormResource().save(null); assertEquals(TemporalType.DATE, xmlVersionMapping.getTemporal()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE, versionResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, versionResource.getTemporal()); - versionResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME); + versionResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIME); ormResource().save(null); assertEquals(TemporalType.TIME, xmlVersionMapping.getTemporal()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME, versionResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, versionResource.getTemporal()); - versionResource.setTemporal(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP); + versionResource.setTemporal(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP); ormResource().save(null); assertEquals(TemporalType.TIMESTAMP, xmlVersionMapping.getTemporal()); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP, versionResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, versionResource.getTemporal()); //set temporal to null in the resource model versionResource.setTemporal(null); @@ -177,10 +177,10 @@ public class XmlVersionMappingTests extends ContextModelTestCase } public void testModifyTemporal() throws Exception { - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping"); - XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping(); - Version versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "versionMapping"); + GenericOrmVersionMapping xmlVersionMapping = (GenericOrmVersionMapping) xmlPersistentAttribute.getMapping(); + XmlVersion versionResource = ormResource().getEntityMappings().getEntities().get(0).getAttributes().getVersions().get(0); ormResource().save(null); assertNull(xmlVersionMapping.getTemporal()); @@ -189,17 +189,17 @@ public class XmlVersionMappingTests extends ContextModelTestCase //set temporal in the context model, verify resource model updated xmlVersionMapping.setTemporal(TemporalType.DATE); ormResource().save(null); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.DATE, versionResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.DATE, versionResource.getTemporal()); assertEquals(TemporalType.DATE, xmlVersionMapping.getTemporal()); xmlVersionMapping.setTemporal(TemporalType.TIME); ormResource().save(null); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIME, versionResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIME, versionResource.getTemporal()); assertEquals(TemporalType.TIME, xmlVersionMapping.getTemporal()); xmlVersionMapping.setTemporal(TemporalType.TIMESTAMP); ormResource().save(null); - assertEquals(org.eclipse.jpt.core.internal.resource.orm.TemporalType.TIMESTAMP, versionResource.getTemporal()); + assertEquals(org.eclipse.jpt.core.resource.orm.TemporalType.TIMESTAMP, versionResource.getTemporal()); assertEquals(TemporalType.TIMESTAMP, xmlVersionMapping.getTemporal()); //set temporal to null in the context model @@ -215,18 +215,18 @@ public class XmlVersionMappingTests extends ContextModelTestCase public void testVersionMappingNoUnderylingJavaAttribute() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "foo"); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "foo"); + assertEquals(2, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmVersionMapping xmlVersionMapping = (GenericOrmVersionMapping) xmlPersistentAttribute.getMapping(); assertEquals("foo", xmlVersionMapping.getName()); assertNull(xmlVersionMapping.getTemporal()); - XmlColumn xmlColumn = xmlVersionMapping.getColumn(); + GenericOrmColumn xmlColumn = xmlVersionMapping.getColumn(); assertNull(xmlColumn.getSpecifiedName()); assertNull(xmlColumn.getSpecifiedUnique()); assertNull(xmlColumn.getSpecifiedNullable()); @@ -259,15 +259,15 @@ public class XmlVersionMappingTests extends ContextModelTestCase //@Enumerated(EnumType.STRING) public void testVirtualMappingMetadataCompleteFalse() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + assertEquals(2, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping(); + GenericOrmVersionMapping xmlVersionMapping = (GenericOrmVersionMapping) xmlPersistentAttribute.getMapping(); assertEquals("id", xmlVersionMapping.getName()); assertEquals(TemporalType.TIMESTAMP, xmlVersionMapping.getTemporal()); - XmlColumn xmlColumn = xmlVersionMapping.getColumn(); + GenericOrmColumn xmlColumn = xmlVersionMapping.getColumn(); assertEquals("MY_COLUMN", xmlColumn.getSpecifiedName()); assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedUnique()); assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedNullable()); @@ -282,16 +282,16 @@ public class XmlVersionMappingTests extends ContextModelTestCase public void testVirtualMappingMetadataCompleteTrue() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - xmlPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); - assertEquals(2, xmlPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.virtualAttributes().next(); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + ormPersistentType.getMapping().setSpecifiedMetadataComplete(Boolean.TRUE); + assertEquals(2, ormPersistentType.virtualAttributesSize()); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.virtualAttributes().next(); - XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping(); + GenericOrmVersionMapping xmlVersionMapping = (GenericOrmVersionMapping) xmlPersistentAttribute.getMapping(); assertEquals("id", xmlVersionMapping.getName()); assertNull(xmlVersionMapping.getTemporal()); - XmlColumn xmlColumn = xmlVersionMapping.getColumn(); + GenericOrmColumn xmlColumn = xmlVersionMapping.getColumn(); assertEquals("id", xmlColumn.getSpecifiedName()); assertEquals(Boolean.FALSE, xmlColumn.getSpecifiedUnique()); assertEquals(Boolean.TRUE, xmlColumn.getSpecifiedNullable()); @@ -307,17 +307,17 @@ public class XmlVersionMappingTests extends ContextModelTestCase public void testSpecifiedMapping() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "id"); - assertEquals(1, xmlPersistentType.virtualAttributesSize()); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "id"); + assertEquals(1, ormPersistentType.virtualAttributesSize()); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.specifiedAttributes().next(); - XmlVersionMapping xmlVersionMapping = (XmlVersionMapping) xmlPersistentAttribute.getMapping(); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.specifiedAttributes().next(); + GenericOrmVersionMapping xmlVersionMapping = (GenericOrmVersionMapping) xmlPersistentAttribute.getMapping(); assertEquals("id", xmlVersionMapping.getName()); assertNull(xmlVersionMapping.getTemporal()); - XmlColumn xmlColumn = xmlVersionMapping.getColumn(); + GenericOrmColumn xmlColumn = xmlVersionMapping.getColumn(); assertNull(xmlColumn.getSpecifiedName()); assertNull(xmlColumn.getSpecifiedUnique()); assertNull(xmlColumn.getSpecifiedNullable()); @@ -343,167 +343,167 @@ public class XmlVersionMappingTests extends ContextModelTestCase public void testVersionMorphToIdMapping() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); - IVersionMapping versionMapping = (IVersionMapping) xmlPersistentAttribute.getMapping(); + VersionMapping versionMapping = (VersionMapping) xmlPersistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof IdMapping); assertEquals("version", xmlPersistentAttribute.getMapping().getName()); - assertEquals(TemporalType.TIME, ((IIdMapping) xmlPersistentAttribute.getMapping()).getTemporal()); - assertEquals("FOO", ((IIdMapping) xmlPersistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((IdMapping) xmlPersistentAttribute.getMapping()).getTemporal()); + assertEquals("FOO", ((IdMapping) xmlPersistentAttribute.getMapping()).getColumn().getSpecifiedName()); } public void testVersionMorphToBasicMapping() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); - IVersionMapping versionMapping = (IVersionMapping) xmlPersistentAttribute.getMapping(); + VersionMapping versionMapping = (VersionMapping) xmlPersistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IBasicMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof BasicMapping); assertEquals("version", xmlPersistentAttribute.getMapping().getName()); - assertEquals(TemporalType.TIME, ((IBasicMapping) xmlPersistentAttribute.getMapping()).getTemporal()); - assertEquals("FOO", ((IBasicMapping) xmlPersistentAttribute.getMapping()).getColumn().getSpecifiedName()); + assertEquals(TemporalType.TIME, ((BasicMapping) xmlPersistentAttribute.getMapping()).getTemporal()); + assertEquals("FOO", ((BasicMapping) xmlPersistentAttribute.getMapping()).getColumn().getSpecifiedName()); } public void testVersionMorphToTransientMapping() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); - IVersionMapping versionMapping = (IVersionMapping) xmlPersistentAttribute.getMapping(); + VersionMapping versionMapping = (VersionMapping) xmlPersistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof ITransientMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof TransientMapping); assertEquals("version", xmlPersistentAttribute.getMapping().getName()); } public void testVersionMorphToEmbeddedMapping() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); - IVersionMapping versionMapping = (IVersionMapping) xmlPersistentAttribute.getMapping(); + VersionMapping versionMapping = (VersionMapping) xmlPersistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedMapping); assertEquals("version", xmlPersistentAttribute.getMapping().getName()); } public void testVersionMorphToEmbeddedIdMapping() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); - IVersionMapping versionMapping = (IVersionMapping) xmlPersistentAttribute.getMapping(); + VersionMapping versionMapping = (VersionMapping) xmlPersistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IEmbeddedIdMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof EmbeddedIdMapping); assertEquals("version", xmlPersistentAttribute.getMapping().getName()); } public void testVersionMorphToOneToOneMapping() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); - IVersionMapping versionMapping = (IVersionMapping) xmlPersistentAttribute.getMapping(); + VersionMapping versionMapping = (VersionMapping) xmlPersistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToOneMapping); assertEquals("version", xmlPersistentAttribute.getMapping().getName()); } public void testVersionMorphToOneToManyMapping() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); - IVersionMapping versionMapping = (IVersionMapping) xmlPersistentAttribute.getMapping(); + VersionMapping versionMapping = (VersionMapping) xmlPersistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IOneToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof OneToManyMapping); assertEquals("version", xmlPersistentAttribute.getMapping().getName()); } public void testVersionMorphToManyToOneMapping() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); - IVersionMapping versionMapping = (IVersionMapping) xmlPersistentAttribute.getMapping(); + VersionMapping versionMapping = (VersionMapping) xmlPersistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToOneMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToOneMapping); assertEquals("version", xmlPersistentAttribute.getMapping().getName()); } public void testVersionMorphToManyToManyMapping() throws Exception { createTestEntityVersionMapping(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); - XmlPersistentAttribute xmlPersistentAttribute = xmlPersistentType.addSpecifiedPersistentAttribute(IMappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, FULLY_QUALIFIED_TYPE_NAME); + OrmPersistentAttribute xmlPersistentAttribute = ormPersistentType.addSpecifiedPersistentAttribute(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY, "version"); - IVersionMapping versionMapping = (IVersionMapping) xmlPersistentAttribute.getMapping(); + VersionMapping versionMapping = (VersionMapping) xmlPersistentAttribute.getMapping(); assertFalse(versionMapping.isDefault()); versionMapping.getColumn().setSpecifiedName("FOO"); versionMapping.setTemporal(TemporalType.TIME); assertFalse(versionMapping.isDefault()); - xmlPersistentAttribute.setSpecifiedMappingKey(IMappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); - assertEquals(1, xmlPersistentType.specifiedAttributesSize()); - assertEquals(xmlPersistentAttribute, xmlPersistentType.specifiedAttributes().next()); - assertTrue(xmlPersistentAttribute.getMapping() instanceof IManyToManyMapping); + xmlPersistentAttribute.setSpecifiedMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); + assertEquals(1, ormPersistentType.specifiedAttributesSize()); + assertEquals(xmlPersistentAttribute, ormPersistentType.specifiedAttributes().next()); + assertTrue(xmlPersistentAttribute.getMapping() instanceof ManyToManyMapping); assertEquals("version", xmlPersistentAttribute.getMapping().getName()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/BaseJpaContentTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/BaseJpaContentTests.java index d83afa39a2..3356fd9e00 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/BaseJpaContentTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/BaseJpaContentTests.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.persistence; -import org.eclipse.jpt.core.internal.context.base.IBaseJpaContent; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource; +import org.eclipse.jpt.core.context.IBaseJpaContent; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceResource; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class BaseJpaContentTests extends ContextModelTestCase diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/ClassRefTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/ClassRefTests.java index b9d84b10cd..fdf5a60c78 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/ClassRefTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/ClassRefTests.java @@ -10,11 +10,11 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.persistence; -import org.eclipse.jpt.core.internal.context.persistence.IClassRef; -import org.eclipse.jpt.core.internal.context.persistence.IPersistenceUnit; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef; -import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit; +import org.eclipse.jpt.core.context.persistence.ClassRef; +import org.eclipse.jpt.core.context.persistence.PersistenceUnit; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef; +import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class ClassRefTests extends ContextModelTestCase @@ -25,13 +25,13 @@ public class ClassRefTests extends ContextModelTestCase public void testUpdateClassName() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add class ref XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef(); xmlClassRef.setJavaClass("com.foo.Bar"); xmlPersistenceUnit.getClasses().add(xmlClassRef); - IClassRef classRef = persistenceUnit.specifiedClassRefs().next(); + ClassRef classRef = persistenceUnit.specifiedClassRefs().next(); // test that class names are initially equal assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass()); @@ -59,13 +59,13 @@ public class ClassRefTests extends ContextModelTestCase public void testModifyClassName() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add class ref XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef(); xmlClassRef.setJavaClass("com.foo.Bar"); xmlPersistenceUnit.getClasses().add(xmlClassRef); - IClassRef classRef = persistenceUnit.specifiedClassRefs().next(); + ClassRef classRef = persistenceUnit.specifiedClassRefs().next(); // test that class names are initially equal assertEquals(classRef.getClassName(), xmlClassRef.getJavaClass()); @@ -101,7 +101,7 @@ public class ClassRefTests extends ContextModelTestCase xmlClassRef.setJavaClass(FULLY_QUALIFIED_TYPE_NAME); xmlPersistenceUnit.getClasses().add(xmlClassRef); - IClassRef classRef = classRef(); + ClassRef classRef = classRef(); assertEquals(FULLY_QUALIFIED_TYPE_NAME, classRef.getJavaPersistentType().getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/MappingFileRefTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/MappingFileRefTests.java index 9fb809050b..1854a15312 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/MappingFileRefTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/MappingFileRefTests.java @@ -10,11 +10,11 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.persistence; -import org.eclipse.jpt.core.internal.context.persistence.IMappingFileRef; -import org.eclipse.jpt.core.internal.context.persistence.IPersistenceUnit; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; -import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit; +import org.eclipse.jpt.core.context.persistence.MappingFileRef; +import org.eclipse.jpt.core.context.persistence.PersistenceUnit; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class MappingFileRefTests extends ContextModelTestCase @@ -23,19 +23,19 @@ public class MappingFileRefTests extends ContextModelTestCase super(name); } - protected IMappingFileRef mappingFileRef() { + protected MappingFileRef mappingFileRef() { return persistenceUnit().mappingFileRefs().next(); } public void testUpdateFileName() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add mapping file ref XmlMappingFileRef xmlFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef(); xmlFileRef.setFileName("foo.xml"); xmlPersistenceUnit.getMappingFiles().add(xmlFileRef); - IMappingFileRef fileRef = persistenceUnit.specifiedMappingFileRefs().next(); + MappingFileRef fileRef = persistenceUnit.specifiedMappingFileRefs().next(); // test that file names are initially equal assertEquals(fileRef.getFileName(), xmlFileRef.getFileName()); @@ -63,13 +63,13 @@ public class MappingFileRefTests extends ContextModelTestCase public void testModifyFileName() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add mapping file ref XmlMappingFileRef xmlFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef(); xmlFileRef.setFileName("foo.xml"); xmlPersistenceUnit.getMappingFiles().add(xmlFileRef); - IMappingFileRef fileRef = persistenceUnit.specifiedMappingFileRefs().next(); + MappingFileRef fileRef = persistenceUnit.specifiedMappingFileRefs().next(); // test that file names are initially equal assertEquals(fileRef.getFileName(), xmlFileRef.getFileName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceTests.java index f663dd50f4..a98d932a15 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceTests.java @@ -10,11 +10,11 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.persistence; -import org.eclipse.jpt.core.internal.context.persistence.IPersistence; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource; -import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistence; -import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit; +import org.eclipse.jpt.core.context.persistence.Persistence; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceResource; +import org.eclipse.jpt.core.resource.persistence.XmlPersistence; +import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class PersistenceTests extends ContextModelTestCase @@ -23,14 +23,14 @@ public class PersistenceTests extends ContextModelTestCase super(name); } - protected IPersistence persistence() { + protected Persistence persistence() { return jpaContent().getPersistenceXml().getPersistence(); } public void testUpdateAddPersistenceUnit() throws Exception { PersistenceResource prm = persistenceResource(); XmlPersistence xmlPersistence = prm.getPersistence(); - IPersistence persistence = jpaContent().getPersistenceXml().getPersistence(); + Persistence persistence = jpaContent().getPersistenceXml().getPersistence(); // clear xml persistence units, test that it's clear in context xmlPersistence.getPersistenceUnits().clear(); @@ -54,7 +54,7 @@ public class PersistenceTests extends ContextModelTestCase public void testModifyAddPersistencUnit() { XmlPersistence xmlPersistence = xmlPersistence(); - IPersistence persistence = persistence(); + Persistence persistence = persistence(); // clear xml persistence units, test that it's clear in context xmlPersistence.getPersistenceUnits().clear(); @@ -74,7 +74,7 @@ public class PersistenceTests extends ContextModelTestCase public void testUpdateRemovePersistenceUnit() throws Exception { PersistenceResource prm = persistenceResource(); XmlPersistence xmlPersistence = prm.getPersistence(); - IPersistence persistence = jpaContent().getPersistenceXml().getPersistence(); + Persistence persistence = jpaContent().getPersistenceXml().getPersistence(); // add a persistence unit and test that there are two existing xml and context persistence unit XmlPersistenceUnit xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit(); @@ -99,7 +99,7 @@ public class PersistenceTests extends ContextModelTestCase public void testModifyRemovePersistenceUnit() { XmlPersistence xmlPersistence = xmlPersistence(); - IPersistence persistence = persistence(); + Persistence persistence = persistence(); // add a persistence unit and test that there are two existing xml and context persistence unit XmlPersistenceUnit xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit(); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java index b1b9736dcd..db2ae20894 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceUnitTests.java @@ -11,22 +11,22 @@ package org.eclipse.jpt.core.tests.internal.context.persistence; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IMappingKeys; -import org.eclipse.jpt.core.internal.JptCorePlugin; -import org.eclipse.jpt.core.internal.context.base.AccessType; -import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType; -import org.eclipse.jpt.core.internal.context.persistence.IPersistenceUnit; -import org.eclipse.jpt.core.internal.context.persistence.IProperty; -import org.eclipse.jpt.core.internal.context.persistence.PersistenceUnitTransactionType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.orm.OrmResource; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.XmlJavaClassRef; -import org.eclipse.jpt.core.internal.resource.persistence.XmlMappingFileRef; -import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.core.internal.resource.persistence.XmlPersistenceUnitTransactionType; -import org.eclipse.jpt.core.internal.resource.persistence.XmlProperties; -import org.eclipse.jpt.core.internal.resource.persistence.XmlProperty; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.MappingKeys; +import org.eclipse.jpt.core.context.AccessType; +import org.eclipse.jpt.core.context.orm.OrmPersistentType; +import org.eclipse.jpt.core.context.persistence.PersistenceUnit; +import org.eclipse.jpt.core.context.persistence.PersistenceUnitTransactionType; +import org.eclipse.jpt.core.context.persistence.Property; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.orm.OrmResource; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.XmlJavaClassRef; +import org.eclipse.jpt.core.resource.persistence.XmlMappingFileRef; +import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnit; +import org.eclipse.jpt.core.resource.persistence.XmlPersistenceUnitTransactionType; +import org.eclipse.jpt.core.resource.persistence.XmlProperties; +import org.eclipse.jpt.core.resource.persistence.XmlProperty; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -39,7 +39,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateName() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test that names are initially equal assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName()); @@ -67,7 +67,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyName() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test that names are initially equal assertEquals(xmlPersistenceUnit.getName(), persistenceUnit.getName()); @@ -95,7 +95,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateTransactionType() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // 1 - initial value is default assertNull(xmlPersistenceUnit.getTransactionType()); @@ -118,7 +118,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyTransactionType() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // 1 - initial value is default assertNull(xmlPersistenceUnit.getTransactionType()); @@ -142,7 +142,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateDescription() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test that descriptions are initially equal assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription()); @@ -170,7 +170,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyDescription() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test that descriptions are initially equal assertEquals(xmlPersistenceUnit.getDescription(), persistenceUnit.getDescription()); @@ -198,7 +198,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateProvider() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test that providers are initially equal assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider()); @@ -226,7 +226,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyProvider() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test that providers are initially equal assertEquals(xmlPersistenceUnit.getProvider(), persistenceUnit.getProvider()); @@ -254,7 +254,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateJtaDataSource() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test that jtaDataSources are initially equal assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource()); @@ -282,7 +282,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyJtaDataSource() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test that jtaDataSources are initially equal assertEquals(xmlPersistenceUnit.getJtaDataSource(), persistenceUnit.getJtaDataSource()); @@ -310,7 +310,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateNonJtaDataSource() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test that nonJtaDataSources are initially equal assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource()); @@ -338,7 +338,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyNonJtaDataSource() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test that nonJtaDataSources are initially equal assertEquals(xmlPersistenceUnit.getNonJtaDataSource(), persistenceUnit.getNonJtaDataSource()); @@ -373,7 +373,7 @@ public class PersistenceUnitTests extends ContextModelTestCase } public void testUpdateImpliedMappingFileRef1() throws Exception { - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test that there is one initially OrmResource ormResource = ormResource(); @@ -389,7 +389,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateImpliedMappingFileRef2() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test that there is one initially OrmResource ormResource = ormResource(); @@ -409,7 +409,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateSpecifiedMappingFileRefs1() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test there are none initially assertEquals(0, xmlPersistenceUnit.getMappingFiles().size()); @@ -432,7 +432,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateSpecifiedMappingFileRefs2() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add two mapping file refs and test that there are two existing in xml and context XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef(); @@ -460,7 +460,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifySpecifiedMappingFileRefs1() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test there are none initially assertEquals(0, xmlPersistenceUnit.getMappingFiles().size()); @@ -479,7 +479,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifySpecifiedMappingFileRefs2() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add two mapping file refs and test that there are two existing in xml and context XmlMappingFileRef xmlMappingFileRef = PersistenceFactory.eINSTANCE.createXmlMappingFileRef(); @@ -505,7 +505,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateClassRefs1() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test there are none initially assertEquals(0, xmlPersistenceUnit.getClasses().size()); @@ -528,7 +528,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateClassRefs2() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add two class refs and test that there are two existing in xml and context XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef(); @@ -556,7 +556,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyClassRefs1() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test there are none initially assertEquals(0, xmlPersistenceUnit.getClasses().size()); @@ -575,7 +575,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyClassRefs2() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add two class refs and test that there are two existing in xml and context XmlJavaClassRef xmlClassRef = PersistenceFactory.eINSTANCE.createXmlJavaClassRef(); @@ -601,7 +601,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateExcludeUnlistedClasses() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // 1 - initial value is default assertFalse(xmlPersistenceUnit.isSetExcludeUnlistedClasses()); @@ -631,7 +631,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyExcludeUnlistedClasses() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // 1 - initial value is default assertFalse(xmlPersistenceUnit.isSetExcludeUnlistedClasses()); @@ -661,7 +661,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateProperties1() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test there are none initially assertNull(xmlPersistenceUnit.getProperties()); @@ -691,7 +691,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdateProperties2() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add two properties and test that there are two existing in xml and context XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties(); @@ -723,7 +723,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyProperties1() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // test there are none initially assertNull(xmlPersistenceUnit.getProperties()); @@ -743,7 +743,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyProperties2() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add two properties and test that there are two existing in xml and context XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties(); @@ -773,7 +773,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyProperties3() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add two properties and test that there are two existing in xml and context persistenceUnit.putProperty("foo", "bar", false); @@ -795,7 +795,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyProperties4() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add two properties and test that there are two existing in xml and context persistenceUnit.putProperty("foo", "bar", false); @@ -831,7 +831,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testModifyProperties5() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // testing duplicate keys, add four properties and test that there are four existing in xml and context persistenceUnit.putProperty("FOO", "BAR", false); @@ -845,7 +845,7 @@ public class PersistenceUnitTests extends ContextModelTestCase // modify a property, test its value persistenceUnit.replacePropertyValue("foo", "bar 2", "bar two"); - IProperty property = persistenceUnit.getProperty("foo", "bar two"); + Property property = persistenceUnit.getProperty("foo", "bar two"); assertEquals("bar two", property.getValue()); // remove a property, test that there are four existing in xml and context @@ -855,13 +855,13 @@ public class PersistenceUnitTests extends ContextModelTestCase } public void testAccessProperty() { - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add two properties and try to access it. persistenceUnit.putProperty("foo", "bar", false); persistenceUnit.putProperty("FOO", "BAR", false); - IProperty property = persistenceUnit.getProperty("foo"); + Property property = persistenceUnit.getProperty("foo"); assertNotNull(property); assertEquals("bar", property.getValue()); assertTrue(persistenceUnit.containsProperty("FOO")); @@ -871,14 +871,14 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdatePropertyName() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add property for testing XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties(); xmlPersistenceUnit.setProperties(xmlProperties); XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty(); xmlProperties.getProperties().add(xmlProperty); - IProperty property = persistenceUnit.properties().next(); + Property property = persistenceUnit.properties().next(); // test that names are initially equal assertEquals(xmlProperty.getName(), property.getName()); @@ -906,14 +906,14 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testUpdatePropertyValue() { XmlPersistenceUnit xmlPersistenceUnit = xmlPersistenceUnit(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); // add property for testing XmlProperties xmlProperties = PersistenceFactory.eINSTANCE.createXmlProperties(); xmlPersistenceUnit.setProperties(xmlProperties); XmlProperty xmlProperty = PersistenceFactory.eINSTANCE.createXmlProperty(); xmlProperties.getProperties().add(xmlProperty); - IProperty property = persistenceUnit.properties().next(); + Property property = persistenceUnit.properties().next(); // test that values are initially equal assertEquals(xmlProperty.getValue(), property.getValue()); @@ -942,7 +942,7 @@ public class PersistenceUnitTests extends ContextModelTestCase public void testGetDefaultAccess() throws Exception { createOrmXmlFile(); - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); entityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY); assertEquals(AccessType.PROPERTY, persistenceUnit.getDefaultAccess()); @@ -978,7 +978,7 @@ public class PersistenceUnitTests extends ContextModelTestCase } public void testPersistentType() throws Exception { - IPersistenceUnit persistenceUnit = persistenceUnit(); + PersistenceUnit persistenceUnit = persistenceUnit(); createTestEntity(); //persistentType not listed in persistence.xml and discoverAnnotatedClasses is false @@ -999,9 +999,9 @@ public class PersistenceUnitTests extends ContextModelTestCase //test persistentType from orm.xml file that is specified in the persistence.xml createOrmXmlFile(); - XmlPersistentType xmlPersistentType = entityMappings().addXmlPersistentType(IMappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); + OrmPersistentType ormPersistentType = entityMappings().addOrmPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, "model.Foo"); assertNotNull(persistenceUnit.persistentType("model.Foo")); - assertEquals(xmlPersistentType, persistenceUnit.persistentType("model.Foo")); + assertEquals(ormPersistentType, persistenceUnit.persistentType("model.Foo")); //test persistentType from orm.xml file that is implied(not specified) in the persistence.xml xmlPersistenceUnit().getMappingFiles().remove(0); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceXmlTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceXmlTests.java index 6520f0e064..8e75b8deb1 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceXmlTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/context/persistence/PersistenceXmlTests.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.jpt.core.tests.internal.context.persistence; -import org.eclipse.jpt.core.internal.context.persistence.IPersistenceXml; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource; +import org.eclipse.jpt.core.context.persistence.PersistenceXml; +import org.eclipse.jpt.core.resource.persistence.PersistenceFactory; +import org.eclipse.jpt.core.resource.persistence.PersistenceResource; import org.eclipse.jpt.core.tests.internal.context.ContextModelTestCase; public class PersistenceXmlTests extends ContextModelTestCase @@ -21,7 +21,7 @@ public class PersistenceXmlTests extends ContextModelTestCase super(name); } - protected IPersistenceXml persistenceXml() { + protected PersistenceXml persistenceXml() { return jpaContent().getPersistenceXml(); } @@ -43,7 +43,7 @@ public class PersistenceXmlTests extends ContextModelTestCase prm.getContents().remove(prm.getPersistence()); assertNull(prm.getPersistence()); - IPersistenceXml persistenceXml = persistenceXml(); + PersistenceXml persistenceXml = persistenceXml(); persistenceXml.addPersistence(); @@ -71,7 +71,7 @@ public class PersistenceXmlTests extends ContextModelTestCase } public void testModifyRemovePersistence() { - IPersistenceXml persistenceXml = persistenceXml(); + PersistenceXml persistenceXml = persistenceXml(); assertNotNull(persistenceXml.getPersistence()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/MemberAnnotationElementAdapterTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/MemberAnnotationElementAdapterTests.java index 3c0fe0a112..00d160a9cf 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/MemberAnnotationElementAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/MemberAnnotationElementAdapterTests.java @@ -11,7 +11,7 @@ package org.eclipse.jpt.core.tests.internal.jdtutility; import java.util.Arrays; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.ASTNodeTextRange; import org.eclipse.jpt.core.internal.jdtutility.AnnotationElementAdapter; import org.eclipse.jpt.core.internal.jdtutility.AnnotationStringArrayExpressionConverter; @@ -336,7 +336,7 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase { DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea); - ITextRange textRange = new ASTNodeTextRange(aea.astNode()); + TextRange textRange = new ASTNodeTextRange(aea.astNode()); assertEquals(this.source().indexOf(value), textRange.getOffset()); assertEquals(value.length(), textRange.getLength()); assertEquals(8, textRange.getLineNumber()); @@ -356,7 +356,7 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase { DeclarationAnnotationElementAdapter<Boolean> daea = new ConversionDeclarationAnnotationElementAdapter<Boolean>(daa3, "fred", BooleanExpressionConverter.instance()); AnnotationElementAdapter<Boolean> aea = new MemberAnnotationElementAdapter<Boolean>(this.idField(), daea); assertEquals(Boolean.FALSE, aea.getValue()); - ITextRange textRange = new ASTNodeTextRange(aea.astNode()); + TextRange textRange = new ASTNodeTextRange(aea.astNode()); assertEquals(value.length(), textRange.getLength()); } @@ -369,7 +369,7 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase { DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa); AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea); - ITextRange textRange = new ASTNodeTextRange(aea.astNode()); + TextRange textRange = new ASTNodeTextRange(aea.astNode()); assertEquals(this.source().indexOf(element), textRange.getOffset()); assertEquals(element.length(), textRange.getLength()); } @@ -382,7 +382,7 @@ public class MemberAnnotationElementAdapterTests extends AnnotationTestCase { DeclarationAnnotationElementAdapter<String> daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa); AnnotationElementAdapter<String> aea = new MemberAnnotationElementAdapter<String>(this.idField(), daea); - ITextRange textRange = new ASTNodeTextRange(aea.astNode()); + TextRange textRange = new ASTNodeTextRange(aea.astNode()); assertEquals(this.source().indexOf(annotation), textRange.getOffset()); assertEquals(annotation.length(), textRange.getLength()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/TypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/TypeTests.java index 60a7078554..b38d6fa0c8 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/TypeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/jdtutility/TypeTests.java @@ -10,7 +10,7 @@ package org.eclipse.jpt.core.tests.internal.jdtutility; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.ITextRange; +import org.eclipse.jpt.core.TextRange; import org.eclipse.jpt.core.internal.jdtutility.Type; public class TypeTests extends AnnotationTestCase { @@ -55,7 +55,7 @@ public class TypeTests extends AnnotationTestCase { public void testTextRange() throws Exception { String source = this.jdtType.getOpenable().getBuffer().getContents(); - ITextRange textRange = this.testType.textRange(); + TextRange textRange = this.testType.textRange(); String body = source.substring(textRange.getOffset()); assertTrue(body.startsWith("public class " + TYPE_NAME)); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java index 640b33814d..d9e0ce55e2 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/model/JpaModelTests.java @@ -17,10 +17,10 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Path; -import org.eclipse.jpt.core.internal.IJpaProject; -import org.eclipse.jpt.core.internal.JpaModel; +import org.eclipse.jpt.core.JpaProject; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.internal.GenericJpaModel; import org.eclipse.jpt.core.internal.JpaModelManager; -import org.eclipse.jpt.core.internal.JptCorePlugin; import org.eclipse.jpt.core.tests.internal.ProjectUtility; import org.eclipse.jpt.core.tests.internal.projects.TestFacetedProject; import org.eclipse.jpt.core.tests.internal.projects.TestPlatformProject; @@ -104,7 +104,7 @@ public class JpaModelTests extends TestCase { testProject.installFacet("jpt.jpa", "1.0"); assertEquals(1, JptCorePlugin.jpaModel().jpaProjectsSize()); - IJpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject()); + JpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject()); assertNotNull(jpaProject); // assertEquals(4, jpaProject.jpaFilesSize()); assertNotNull(jpaProject.jpaFile(this.file(testProject, "src/test.pkg/TestEntity.java"))); @@ -126,7 +126,7 @@ public class JpaModelTests extends TestCase { testProject.getProject().close(null); assertFalse(testProject.getProject().isOpen()); - IJpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject()); + JpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject()); assertNull(jpaProject); testProject.getProject().open(null); @@ -144,7 +144,7 @@ public class JpaModelTests extends TestCase { public void testProjectDeleteReimport() throws Exception { TestFacetedProject testProject = this.buildTestProject(); testProject.installFacet("jpt.jpa", "1.0"); - IJpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject()); + JpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject()); assertNotNull(jpaProject); assertEquals(1, JptCorePlugin.jpaModel().jpaProjectsSize()); @@ -192,7 +192,7 @@ public class JpaModelTests extends TestCase { facetSettingsFile.setContents(new ByteArrayInputStream(newDocument.getBytes()), false, false, null); assertEquals(1, JptCorePlugin.jpaModel().jpaProjectsSize()); - IJpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject()); + JpaProject jpaProject = JptCorePlugin.jpaProject(testProject.getProject()); assertNotNull(jpaProject); // persistence.xml and orm.xml do not get created in this situation (?) assertEquals(2, jpaProject.jpaFilesSize()); @@ -219,7 +219,7 @@ public class JpaModelTests extends TestCase { */ public void testDEBUG() { this.verifyDEBUG(JpaModelManager.class); - this.verifyDEBUG(JpaModel.class); + this.verifyDEBUG(GenericJpaModel.class); } private void verifyDEBUG(Class<?> clazz) { diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java index f892e3a2f3..de4f9eb4e4 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/projects/TestJpaProject.java @@ -10,8 +10,8 @@ package org.eclipse.jpt.core.tests.internal.projects; import org.eclipse.core.runtime.CoreException; -import org.eclipse.jpt.core.internal.IJpaProject; -import org.eclipse.jpt.core.internal.JptCorePlugin; +import org.eclipse.jpt.core.JpaProject; +import org.eclipse.jpt.core.JptCorePlugin; import org.eclipse.jpt.core.internal.SynchronousJpaProjectUpdater; import org.eclipse.wst.common.frameworks.datamodel.IDataModel; @@ -23,7 +23,7 @@ import org.eclipse.wst.common.frameworks.datamodel.IDataModel; * controlled by building a data model and passing it into the constructor. */ public class TestJpaProject extends TestJavaProject { - private final IJpaProject jpaProject; + private final JpaProject jpaProject; public static final String JAR_NAME_SYSTEM_PROPERTY = "org.eclipse.jpt.jpa.jar"; @@ -66,7 +66,7 @@ public class TestJpaProject extends TestJavaProject { // ********** public methods ********** - public IJpaProject getJpaProject() { + public JpaProject getJpaProject() { return this.jpaProject; } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/OrmModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/OrmModelTests.java index 78746ac13c..9268643cf9 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/OrmModelTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/OrmModelTests.java @@ -1,8 +1,8 @@ package org.eclipse.jpt.core.tests.internal.resource; import junit.framework.TestCase; -import org.eclipse.jpt.core.internal.resource.orm.OrmArtifactEdit; -import org.eclipse.jpt.core.internal.resource.orm.OrmResource; +import org.eclipse.jpt.core.resource.orm.OrmArtifactEdit; +import org.eclipse.jpt.core.resource.orm.OrmResource; import org.eclipse.jpt.core.tests.internal.ProjectUtility; import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject; diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/PersistenceModelTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/PersistenceModelTests.java index 571ee4e0cc..72896e825e 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/PersistenceModelTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/PersistenceModelTests.java @@ -1,8 +1,8 @@ package org.eclipse.jpt.core.tests.internal.resource; import junit.framework.TestCase; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceArtifactEdit; -import org.eclipse.jpt.core.internal.resource.persistence.PersistenceResource; +import org.eclipse.jpt.core.resource.persistence.PersistenceArtifactEdit; +import org.eclipse.jpt.core.resource.persistence.PersistenceResource; import org.eclipse.jpt.core.tests.internal.ProjectUtility; import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject; diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java index fcdb2508b9..515553a169 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverrideTests.java @@ -12,11 +12,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.AssociationOverride; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JoinColumn; +import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class AssociationOverrideTests extends JavaResourceModelTestCase { @@ -75,9 +75,9 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestAssociationOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); assertNotNull(associationOverride); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -85,9 +85,9 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestAssociationOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); assertNotNull(associationOverride); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -99,9 +99,9 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestAssociationOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -115,20 +115,20 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { public void testJoinColumns() throws Exception { IType testType = this.createTestAssociationOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(0, associationOverride.joinColumnsSize()); } public void testJoinColumns2() throws Exception { IType testType = this.createTestAssociationOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); associationOverride.addJoinColumn(0); @@ -140,20 +140,20 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { public void testJoinColumns3() throws Exception { IType testType = this.createTestAssociationOverrideWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(2, associationOverride.joinColumnsSize()); } public void testAddJoinColumn() throws Exception { IType testType = this.createTestAssociationOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); associationOverride.addJoinColumn(0).setName("FOO"); associationOverride.addJoinColumn(1); @@ -168,13 +168,13 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { public void testRemoveJoinColumn() throws Exception { IType testType = this.createTestAssociationOverrideWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); associationOverride.addJoinColumn(0).setName("FOO"); - Iterator<JoinColumn> joinColumns = associationOverride.joinColumns(); + Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns(); assertEquals("FOO", joinColumns.next().getName()); assertEquals("BAR", joinColumns.next().getName()); assertNull(joinColumns.next().getName()); @@ -202,11 +202,11 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { public void testMoveJoinColumn() throws Exception { IType testType = this.createTestAssociationOverrideWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); - JoinColumn joinColumn = associationOverride.joinColumnAt(0); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); joinColumn.setNullable(Boolean.FALSE); @@ -228,12 +228,12 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { public void testMoveJoinColumn2() throws Exception { IType testType = this.createTestAssociationOverrideWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); - JoinColumn joinColumn = associationOverride.joinColumnAt(0); + JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); joinColumn.setNullable(Boolean.FALSE); @@ -255,14 +255,14 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { public void testSetJoinColumnName() throws Exception { IType testType = this.createTestAssociationOverrideWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(2, associationOverride.joinColumnsSize()); - JoinColumn joinColumn = associationOverride.joinColumns().next(); + JoinColumnAnnotation joinColumn = associationOverride.joinColumns().next(); assertEquals("BAR", joinColumn.getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java index 8b278e5a7d..b438bfbe2d 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AssociationOverridesTests.java @@ -12,13 +12,13 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.AssociationOverride; -import org.eclipse.jpt.core.internal.resource.java.AssociationOverrides; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.JoinColumn; +import org.eclipse.jpt.core.resource.java.AssociationOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.AssociationOverrides; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -100,10 +100,10 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestAssociationOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); AssociationOverrides associationOverrides = (AssociationOverrides) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDES); - AssociationOverride associationOverride = associationOverrides.nestedAnnotations().next(); + AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next(); assertNotNull(associationOverride); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -111,10 +111,10 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestAssociationOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); AssociationOverrides associationOverrides = (AssociationOverrides) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDES); - AssociationOverride associationOverride = associationOverrides.nestedAnnotations().next(); + AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next(); assertNotNull(associationOverride); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -126,10 +126,10 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestAssociationOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); AssociationOverrides associationOverrides = (AssociationOverrides) attributeResource.annotation(JPA.ASSOCIATION_OVERRIDES); - AssociationOverride associationOverride = associationOverrides.nestedAnnotations().next(); + AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next(); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); associationOverride.setName(null); @@ -142,9 +142,9 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { public void testAddAssociationOverrideCopyExisting() throws Exception { IType jdtType = createTestAssociationOverride(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - AssociationOverride associationOverride = (AssociationOverride) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); assertSourceContains("@AssociationOverrides({@AssociationOverride(name=\"FOO\", joinColumns = @JoinColumn(name=\"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name=\"BAR\")})"); @@ -155,20 +155,20 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { public void testAddAssociationOverrideToBeginningOfList() throws Exception { IType jdtType = createTestAssociationOverride(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - AssociationOverride associationOverride = (AssociationOverride) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); assertSourceContains("@AssociationOverrides({@AssociationOverride(name=\"FOO\", joinColumns = @JoinColumn(name=\"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name=\"BAR\")})"); - associationOverride = (AssociationOverride) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAZ"); assertSourceContains("@AssociationOverrides({@AssociationOverride(name=\"BAZ\"),@AssociationOverride(name=\"FOO\", joinColumns = @JoinColumn(name=\"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")), @AssociationOverride(name=\"BAR\")})"); - Iterator<JavaResource> associationOverrides = typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); - assertEquals("BAZ", ((AssociationOverride) associationOverrides.next()).getName()); - assertEquals("FOO", ((AssociationOverride) associationOverrides.next()).getName()); - assertEquals("BAR", ((AssociationOverride) associationOverrides.next()).getName()); + Iterator<JavaResourceNode> associationOverrides = typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + assertEquals("BAZ", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); + assertEquals("FOO", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); + assertEquals("BAR", ((AssociationOverrideAnnotation) associationOverrides.next()).getName()); assertNull(typeResource.annotation(JPA.ASSOCIATION_OVERRIDE)); assertNotNull(typeResource.annotation(JPA.ASSOCIATION_OVERRIDES)); @@ -177,9 +177,9 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { public void testRemoveAssociationOverrideCopyExisting() throws Exception { IType jdtType = createTestAssociationOverride(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - AssociationOverride associationOverride = (AssociationOverride) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); associationOverride.setName("BAR"); assertSourceContains("@AssociationOverrides({@AssociationOverride(name=\"FOO\", joinColumns = @JoinColumn(name=\"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\")),@AssociationOverride(name=\"BAR\")})"); @@ -189,20 +189,20 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { public void testJoinColumns() throws Exception { IType testType = this.createTestAssociationOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); assertEquals(0, associationOverride.joinColumnsSize()); } public void testJoinColumns2() throws Exception { IType testType = this.createTestAssociationOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); associationOverride.addJoinColumn(0); associationOverride.addJoinColumn(1); @@ -213,27 +213,27 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { public void testJoinColumns3() throws Exception { IType testType = this.createTestAssociationOverrideWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); assertEquals(2, associationOverride.joinColumnsSize()); } public void testAddJoinColumn() throws Exception { IType testType = this.createTestAssociationOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); associationOverride.addJoinColumn(0).setName("FOO"); associationOverride.addJoinColumn(1); associationOverride.addJoinColumn(0).setName("BAR"); - Iterator<JoinColumn> joinColumns = associationOverride.joinColumns(); + Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns(); assertEquals("BAR", joinColumns.next().getName()); assertEquals("FOO", joinColumns.next().getName()); assertNull(joinColumns.next().getName()); @@ -243,13 +243,13 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { public void testRemoveJoinColumn() throws Exception { IType testType = this.createTestAssociationOverrideWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); associationOverride.addJoinColumn(0).setName("FOO"); - Iterator<JoinColumn> joinColumns = associationOverride.joinColumns(); + Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns(); assertEquals("FOO", joinColumns.next().getName()); assertEquals("BAR", joinColumns.next().getName()); assertNull(joinColumns.next().getName()); @@ -277,11 +277,11 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { public void testMoveJoinColumn() throws Exception { IType testType = this.createTestAssociationOverrideWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); - JoinColumn joinColumn = associationOverride.joinColumnAt(0); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); joinColumn.setNullable(Boolean.FALSE); @@ -302,12 +302,12 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { public void testMoveJoinColumn2() throws Exception { IType testType = this.createTestAssociationOverrideWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); - JoinColumn joinColumn = associationOverride.joinColumnAt(0); + JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); joinColumn.setNullable(Boolean.FALSE); @@ -328,14 +328,14 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { public void testSetJoinColumnName() throws Exception { IType testType = this.createTestAssociationOverrideWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverride associationOverride = (AssociationOverride) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); assertEquals(2, associationOverride.joinColumnsSize()); - JoinColumn joinColumn = associationOverride.joinColumns().next(); + JoinColumnAnnotation joinColumn = associationOverride.joinColumns().next(); assertEquals("BAR", joinColumn.getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java index 663f02bc33..ad1472288e 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverrideTests.java @@ -12,11 +12,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.AttributeOverride; -import org.eclipse.jpt.core.internal.resource.java.Column; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class AttributeOverrideTests extends JavaResourceModelTestCase { @@ -80,9 +80,9 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestAttributeOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); assertNotNull(attributeOverride); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -90,19 +90,19 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { public void testGetNullColumn() throws Exception { IType testType = this.createTestAttributeOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); - Column column = attributeOverride.getColumn(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + ColumnAnnotation column = attributeOverride.getColumn(); assertNotNull(attributeOverride); assertNull(column); } public void testSetName() throws Exception { IType testType = this.createTestAttributeOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); assertNotNull(attributeOverride); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -114,9 +114,9 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestAttributeOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -129,19 +129,19 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { public void testColumnGetName() throws Exception { IType testType = this.createTestAttributeOverrideWithColumnOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); - Column column = attributeOverride.getColumn(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + ColumnAnnotation column = attributeOverride.getColumn(); assertEquals(COLUMN_NAME, column.getName()); } public void testColumnSetName() throws Exception { IType testType = this.createTestAttributeOverrideWithColumnOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); - Column column = attributeOverride.getColumn(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + ColumnAnnotation column = attributeOverride.getColumn(); assertEquals(COLUMN_NAME, column.getName()); column.setName("Foo"); @@ -157,19 +157,19 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { public void testAddColumn() throws Exception { IType testType = this.createTestAttributeOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); - Column column = attributeOverride.getColumn(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + ColumnAnnotation column = attributeOverride.getColumn(); assertNull(column); } public void testRemoveColumn() throws Exception { IType testType = this.createTestAttributeOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); - Column column = attributeOverride.getColumn(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE); + ColumnAnnotation column = attributeOverride.getColumn(); assertNull(column); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java index f18d1e89be..f57f0ff586 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/AttributeOverridesTests.java @@ -12,13 +12,13 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.AttributeOverride; -import org.eclipse.jpt.core.internal.resource.java.AttributeOverrides; -import org.eclipse.jpt.core.internal.resource.java.Column; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; +import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.AttributeOverrides; +import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -104,10 +104,10 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestAttributeOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES); - AttributeOverride attributeOverride = attributeOverrides.nestedAnnotations().next(); + AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); assertNotNull(attributeOverride); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -115,21 +115,21 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { public void testGetNullColumn() throws Exception { IType testType = this.createTestAttributeOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES); - AttributeOverride attributeOverride = attributeOverrides.nestedAnnotations().next(); - Column column = attributeOverride.getColumn(); + AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); + ColumnAnnotation column = attributeOverride.getColumn(); assertNotNull(attributeOverride); assertNull(column); } public void testSetName() throws Exception { IType testType = this.createTestAttributeOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES); - AttributeOverride attributeOverride = attributeOverrides.nestedAnnotations().next(); + AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); assertNotNull(attributeOverride); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -141,10 +141,10 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestAttributeOverrideOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES); - AttributeOverride attributeOverride = attributeOverrides.nestedAnnotations().next(); + AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); attributeOverride.setName(null); @@ -157,22 +157,22 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { public void testColumnGetName() throws Exception { IType testType = this.createTestAttributeOverrideWithColumnOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); AttributeOverrides attributeOverrides = (AttributeOverrides) attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES); - AttributeOverride attributeOverride = attributeOverrides.nestedAnnotations().next(); + AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); - Column column = attributeOverride.getColumn(); + ColumnAnnotation column = attributeOverride.getColumn(); assertEquals(COLUMN_NAME, column.getName()); } public void testColumnSetName() throws Exception { IType testType = this.createTestAttributeOverrideWithColumnOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); - Column column = attributeOverride.getColumn(); + ColumnAnnotation column = attributeOverride.getColumn(); assertEquals(COLUMN_NAME, column.getName()); @@ -189,9 +189,9 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { public void testAddAttributeOverrideCopyExisting() throws Exception { IType jdtType = createTestAttributeOverride(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - AttributeOverride attributeOverride = (AttributeOverride) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\", column = @Column(name=\"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)),@AttributeOverride(name=\"BAR\")})"); @@ -202,20 +202,20 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { public void testAddAttributeOverrideToBeginningOfList() throws Exception { IType jdtType = createTestAttributeOverride(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - AttributeOverride attributeOverride = (AttributeOverride) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\", column = @Column(name=\"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)),@AttributeOverride(name=\"BAR\")})"); - attributeOverride = (AttributeOverride) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAZ"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"BAZ\"),@AttributeOverride(name=\"FOO\", column = @Column(name=\"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)), @AttributeOverride(name=\"BAR\")})"); - Iterator<JavaResource> attributeOverrides = typeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); - assertEquals("BAZ", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("FOO", ((AttributeOverride) attributeOverrides.next()).getName()); - assertEquals("BAR", ((AttributeOverride) attributeOverrides.next()).getName()); + Iterator<JavaResourceNode> attributeOverrides = typeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + assertEquals("BAZ", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("FOO", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); + assertEquals("BAR", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName()); assertNull(typeResource.annotation(JPA.ATTRIBUTE_OVERRIDE)); assertNotNull(typeResource.annotation(JPA.ATTRIBUTE_OVERRIDES)); @@ -224,9 +224,9 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { public void testRemoveAttributeOverrideCopyExisting() throws Exception { IType jdtType = createTestAttributeOverride(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - AttributeOverride attributeOverride = (AttributeOverride) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\", column = @Column(name=\"FOO\", columnDefinition = \"BAR\", table = \"BAZ\", unique = false, nullable = false, insertable = false, updatable = false, length = 1, precision = 1, scale = 1)),@AttributeOverride(name=\"BAR\")})"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java index 35895d46ee..7edfb3e0a1 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/BasicTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.FetchType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.FetchType; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class BasicTests extends JavaResourceModelTestCase { @@ -69,8 +69,8 @@ public class BasicTests extends JavaResourceModelTestCase { public void testBasic() throws Exception { IType testType = this.createTestBasic(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); assertNotNull(basic); @@ -78,8 +78,8 @@ public class BasicTests extends JavaResourceModelTestCase { public void testGetOptional() throws Exception { IType testType = this.createTestBasicWithOptional(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); assertTrue(basic.getOptional()); @@ -87,8 +87,8 @@ public class BasicTests extends JavaResourceModelTestCase { public void testSetOptional() throws Exception { IType testType = this.createTestBasicWithOptional(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); assertTrue(basic.getOptional()); @@ -101,8 +101,8 @@ public class BasicTests extends JavaResourceModelTestCase { public void testSetOptionalNull() throws Exception { IType testType = this.createTestBasicWithOptional(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); assertTrue(basic.getOptional()); @@ -116,8 +116,8 @@ public class BasicTests extends JavaResourceModelTestCase { public void testGetFetch() throws Exception { IType testType = this.createTestBasicWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); assertEquals(FetchType.EAGER, basic.getFetch()); @@ -125,8 +125,8 @@ public class BasicTests extends JavaResourceModelTestCase { public void testSetFetch() throws Exception { IType testType = this.createTestBasicWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); assertEquals(FetchType.EAGER, basic.getFetch()); @@ -139,8 +139,8 @@ public class BasicTests extends JavaResourceModelTestCase { public void testSetFetchNull() throws Exception { IType testType = this.createTestBasicWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Basic basic = (Basic) attributeResource.mappingAnnotation(JPA.BASIC); assertEquals(FetchType.EAGER, basic.getFetch()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java index 388c46190d..12e850647c 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ColumnTests.java @@ -11,10 +11,10 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.Column; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class ColumnTests extends JavaResourceModelTestCase { @@ -127,18 +127,18 @@ public class ColumnTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestColumnWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } public void testGetNull() throws Exception { IType testType = this.createTestColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getName()); assertNull(column.getNullable()); @@ -151,9 +151,9 @@ public class ColumnTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getName()); @@ -166,9 +166,9 @@ public class ColumnTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestColumnWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(COLUMN_NAME, column.getName()); @@ -180,17 +180,17 @@ public class ColumnTests extends JavaResourceModelTestCase { public void testGetTable() throws Exception { IType testType = this.createTestColumnWithTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(COLUMN_TABLE, column.getTable()); } public void testSetTable() throws Exception { IType testType = this.createTestColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getTable()); @@ -207,17 +207,17 @@ public class ColumnTests extends JavaResourceModelTestCase { public void testGetColumnDefinition() throws Exception { IType testType = this.createTestColumnWithColumnDefinition(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } public void testSetColumnDefinition() throws Exception { IType testType = this.createTestColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -234,18 +234,18 @@ public class ColumnTests extends JavaResourceModelTestCase { public void testGetUnique() throws Exception { IType testType = this.createTestColumnWithBooleanElement("unique"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Boolean.TRUE, column.getUnique()); } public void testSetUnique() throws Exception { IType testType = this.createTestColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getUnique()); @@ -261,18 +261,18 @@ public class ColumnTests extends JavaResourceModelTestCase { public void testGetNullable() throws Exception { IType testType = this.createTestColumnWithBooleanElement("nullable"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Boolean.TRUE, column.getNullable()); } public void testSetNullable() throws Exception { IType testType = this.createTestColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getNullable()); @@ -288,18 +288,18 @@ public class ColumnTests extends JavaResourceModelTestCase { public void testGetInsertable() throws Exception { IType testType = this.createTestColumnWithBooleanElement("insertable"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Boolean.TRUE, column.getInsertable()); } public void testSetInsertable() throws Exception { IType testType = this.createTestColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getInsertable()); @@ -315,18 +315,18 @@ public class ColumnTests extends JavaResourceModelTestCase { public void testGetUpdatable() throws Exception { IType testType = this.createTestColumnWithBooleanElement("updatable"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Boolean.TRUE, column.getUpdatable()); } public void testSetUpdatable() throws Exception { IType testType = this.createTestColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getUpdatable()); @@ -342,18 +342,18 @@ public class ColumnTests extends JavaResourceModelTestCase { public void testGetLength() throws Exception { IType testType = this.createTestColumnWithIntElement("length"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Integer.valueOf(5), column.getLength()); } public void testSetLength() throws Exception { IType testType = this.createTestColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getLength()); @@ -369,18 +369,18 @@ public class ColumnTests extends JavaResourceModelTestCase { public void testGetPrecision() throws Exception { IType testType = this.createTestColumnWithIntElement("precision"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Integer.valueOf(5), column.getPrecision()); } public void testSetPrecision() throws Exception { IType testType = this.createTestColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertNotNull(column); assertEquals(null, column.getPrecision()); @@ -396,18 +396,18 @@ public class ColumnTests extends JavaResourceModelTestCase { public void testGetScale() throws Exception { IType testType = this.createTestColumnWithIntElement("scale"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals(Integer.valueOf(5), column.getScale()); } public void testSetScale() throws Exception { IType testType = this.createTestColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getScale()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java index 76a8d64d5d..29bf0142b9 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorColumnTests.java @@ -11,10 +11,10 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.DiscriminatorColumn; -import org.eclipse.jpt.core.internal.resource.java.DiscriminatorType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.resource.java.DiscriminatorColumnAnnotation; +import org.eclipse.jpt.core.resource.java.DiscriminatorType; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class DiscriminatorColumnTests extends JavaResourceModelTestCase { @@ -107,16 +107,16 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestDiscriminatorColumnWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } public void testGetNull() throws Exception { IType testType = this.createTestDiscriminatorColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertNull(column.getName()); assertNull(column.getDiscriminatorType()); @@ -125,8 +125,8 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestDiscriminatorColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertNull(column.getName()); @@ -139,8 +139,8 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestDiscriminatorColumnWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(COLUMN_NAME, column.getName()); @@ -152,15 +152,15 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetColumnDefinition() throws Exception { IType testType = this.createTestDiscriminatorColumnWithColumnDefinition(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } public void testSetColumnDefinition() throws Exception { IType testType = this.createTestDiscriminatorColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -177,16 +177,16 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetLength() throws Exception { IType testType = this.createTestColumnWithIntElement("length"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(Integer.valueOf(5), column.getLength()); } public void testSetLength() throws Exception { IType testType = this.createTestDiscriminatorColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertNull(column.getLength()); @@ -202,15 +202,15 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetDiscriminatorType() throws Exception { IType testType = this.createTestDiscriminatorColumnWithDiscriminatorType(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(DiscriminatorType.CHAR, column.getDiscriminatorType()); } public void testSetDiscriminatorType() throws Exception { IType testType = this.createTestDiscriminatorColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - DiscriminatorColumn column = (DiscriminatorColumn) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.annotation(JPA.DISCRIMINATOR_COLUMN); assertNull(column.getDiscriminatorType()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java index d10d7c377c..4a1c7c805e 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/DiscriminatorValueTests.java @@ -11,9 +11,9 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.DiscriminatorValue; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.resource.java.DiscriminatorValue; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class DiscriminatorValueTests extends JavaResourceModelTestCase { @@ -52,7 +52,7 @@ public class DiscriminatorValueTests extends JavaResourceModelTestCase { public void testDiscriminatorValue() throws Exception { IType testType = this.createTestDiscriminatorValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); DiscriminatorValue discriminatorValue = (DiscriminatorValue) typeResource.annotation(JPA.DISCRIMINATOR_VALUE); assertNotNull(discriminatorValue); @@ -60,7 +60,7 @@ public class DiscriminatorValueTests extends JavaResourceModelTestCase { public void testGetValue() throws Exception { IType testType = this.createTestDiscriminatorValueWithValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); DiscriminatorValue discriminatorValue = (DiscriminatorValue) typeResource.annotation(JPA.DISCRIMINATOR_VALUE); assertEquals("discriminator", discriminatorValue.getValue()); @@ -68,7 +68,7 @@ public class DiscriminatorValueTests extends JavaResourceModelTestCase { public void testSetValue() throws Exception { IType testType = this.createTestDiscriminatorValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); DiscriminatorValue discriminatorValue = (DiscriminatorValue) typeResource.annotation(JPA.DISCRIMINATOR_VALUE); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java index 41a3718e0f..f26bc017b8 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddableTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.Embeddable; -import org.eclipse.jpt.core.internal.resource.java.Entity; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; +import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation; +import org.eclipse.jpt.core.resource.java.EntityAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class EmbeddableTests extends JavaResourceModelTestCase { @@ -56,20 +56,20 @@ public class EmbeddableTests extends JavaResourceModelTestCase { public void testEmbeddable() throws Exception { IType testType = this.createTestEmbeddable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - JavaResource mappingAnnotation = typeResource.mappingAnnotation(); - assertTrue(mappingAnnotation instanceof Embeddable); + JavaResourceNode mappingAnnotation = typeResource.mappingAnnotation(); + assertTrue(mappingAnnotation instanceof EmbeddableAnnotation); } public void testEmbeddableAndEntity() throws Exception { IType testType = this.createTestEmbeddableAndEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - JavaResource mappingAnnotation = typeResource.mappingAnnotation(); - assertTrue(mappingAnnotation instanceof Embeddable); + JavaResourceNode mappingAnnotation = typeResource.mappingAnnotation(); + assertTrue(mappingAnnotation instanceof EmbeddableAnnotation); - Entity entity = (Entity) typeResource.mappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.mappingAnnotation(JPA.ENTITY); assertNotNull(entity); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java index ad46a125a9..612a64da32 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedIdTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.EmbeddedId; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; +import org.eclipse.jpt.core.resource.java.EmbeddedId; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class EmbeddedIdTests extends JavaResourceModelTestCase { @@ -40,10 +40,10 @@ public class EmbeddedIdTests extends JavaResourceModelTestCase { public void testEmbeddedId() throws Exception { IType testType = this.createTestEmbeddedId(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResource mappingAnnotation = attributeResource.mappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.mappingAnnotation(); assertTrue(mappingAnnotation instanceof EmbeddedId); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java index cbac60ed83..b60da60cf8 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EmbeddedTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.Embedded; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; +import org.eclipse.jpt.core.resource.java.Embedded; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class EmbeddedTests extends JavaResourceModelTestCase { @@ -40,10 +40,10 @@ public class EmbeddedTests extends JavaResourceModelTestCase { public void testEmbedded() throws Exception { IType testType = this.createTestEmbedded(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResource mappingAnnotation = attributeResource.mappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.mappingAnnotation(); assertTrue(mappingAnnotation instanceof Embedded); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java index 0ed5ed4c03..659ef4ecf6 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EntityTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.Entity; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.MappedSuperclass; +import org.eclipse.jpt.core.resource.java.EntityAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class EntityTests extends JavaResourceModelTestCase { @@ -72,27 +72,27 @@ public class EntityTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestEntityWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Entity entity = (Entity) typeResource.mappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.mappingAnnotation(JPA.ENTITY); assertTrue(entity != null); assertEquals(ENTITY_NAME, entity.getName()); } public void testGetNameNull() throws Exception { IType testType = this.createTestEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Entity entity = (Entity) typeResource.mappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.mappingAnnotation(JPA.ENTITY); assertTrue(entity != null); assertNull(entity.getName()); } public void testSetName() throws Exception { IType testType = this.createTestEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Entity entity = (Entity) typeResource.mappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.mappingAnnotation(JPA.ENTITY); assertNull(entity.getName()); entity.setName("Foo"); assertEquals("Foo", entity.getName()); @@ -102,9 +102,9 @@ public class EntityTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestEntityWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Entity entity = (Entity) typeResource.mappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.mappingAnnotation(JPA.ENTITY); assertEquals(ENTITY_NAME, entity.getName()); entity.setName(null); @@ -116,12 +116,12 @@ public class EntityTests extends JavaResourceModelTestCase { public void testMappedSuperclassAndEntity() throws Exception { IType testType = this.createTestMappedSuperclassAndEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - JavaResource mappingAnnotation = typeResource.mappingAnnotation(); - assertTrue(mappingAnnotation instanceof Entity); + JavaResourceNode mappingAnnotation = typeResource.mappingAnnotation(); + assertTrue(mappingAnnotation instanceof EntityAnnotation); - MappedSuperclass mappedSuperclass = (MappedSuperclass) typeResource.mappingAnnotation(JPA.MAPPED_SUPERCLASS); + MappedSuperclassAnnotation mappedSuperclass = (MappedSuperclassAnnotation) typeResource.mappingAnnotation(JPA.MAPPED_SUPERCLASS); assertNotNull(mappedSuperclass); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java index eb5a87fdd3..78c9faaaf2 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/EnumeratedTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.EnumType; -import org.eclipse.jpt.core.internal.resource.java.Enumerated; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.resource.java.EnumType; +import org.eclipse.jpt.core.resource.java.Enumerated; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class EnumeratedTests extends JavaResourceModelTestCase { @@ -56,8 +56,8 @@ public class EnumeratedTests extends JavaResourceModelTestCase { public void testEnumerated() throws Exception { IType testType = this.createTestEnumerated(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Enumerated enumerated = (Enumerated) attributeResource.annotation(JPA.ENUMERATED); assertNotNull(enumerated); @@ -65,8 +65,8 @@ public class EnumeratedTests extends JavaResourceModelTestCase { public void testGetValue() throws Exception { IType testType = this.createTestEnumeratedWithValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Enumerated enumerated = (Enumerated) attributeResource.annotation(JPA.ENUMERATED); assertEquals(EnumType.ORDINAL, enumerated.getValue()); @@ -74,8 +74,8 @@ public class EnumeratedTests extends JavaResourceModelTestCase { public void testSetValue() throws Exception { IType testType = this.createTestEnumerated(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Enumerated enumerated = (Enumerated) attributeResource.annotation(JPA.ENUMERATED); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java index cd06d1d1f0..12c67052a8 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/GeneratedValueTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.GeneratedValue; -import org.eclipse.jpt.core.internal.resource.java.GenerationType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation; +import org.eclipse.jpt.core.resource.java.GenerationType; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class GeneratedValueTests extends JavaResourceModelTestCase { @@ -78,28 +78,28 @@ public class GeneratedValueTests extends JavaResourceModelTestCase { public void testGeneratedValue() throws Exception { IType testType = this.createTestGeneratedValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.annotation(JPA.GENERATED_VALUE); assertNotNull(generatedValue); } public void testGetGenerator() throws Exception { IType testType = this.createTestGeneratedValueWithGenerator(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.annotation(JPA.GENERATED_VALUE); assertEquals(GENERATOR, generatedValue.getGenerator()); } public void testSetGenerator() throws Exception { IType testType = this.createTestGeneratedValueWithGenerator(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.annotation(JPA.GENERATED_VALUE); assertEquals(GENERATOR, generatedValue.getGenerator()); generatedValue.setGenerator("foo"); @@ -116,19 +116,19 @@ public class GeneratedValueTests extends JavaResourceModelTestCase { public void testGetStrategy() throws Exception { IType testType = this.createTestGeneratedValueWithStrategy(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.annotation(JPA.GENERATED_VALUE); assertEquals(GenerationType.SEQUENCE, generatedValue.getStrategy()); } public void testSetStrategy() throws Exception { IType testType = this.createTestGeneratedValueWithStrategy(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValue generatedValue = (GeneratedValue) attributeResource.annotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.annotation(JPA.GENERATED_VALUE); assertEquals(GenerationType.SEQUENCE, generatedValue.getStrategy()); generatedValue.setStrategy(GenerationType.TABLE); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java index 8f5a43eca9..637cd6aa76 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdClassTests.java @@ -12,9 +12,9 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.IdClass; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.resource.java.IdClass; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class IdClassTests extends JavaResourceModelTestCase { @@ -59,7 +59,7 @@ public class IdClassTests extends JavaResourceModelTestCase { public void testIdClass() throws Exception { IType testType = this.createTestIdClass(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); IdClass idClass = (IdClass) typeResource.annotation(JPA.ID_CLASS); assertNotNull(idClass); @@ -68,7 +68,7 @@ public class IdClassTests extends JavaResourceModelTestCase { public void testGetValue() throws Exception { IType testType = this.createTestIdClassWithValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); IdClass idClass = (IdClass) typeResource.annotation(JPA.ID_CLASS); assertEquals(ID_CLASS_VALUE, idClass.getValue()); @@ -76,7 +76,7 @@ public class IdClassTests extends JavaResourceModelTestCase { public void testSetValue() throws Exception { IType testType = this.createTestIdClassWithValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); IdClass idClass = (IdClass) typeResource.annotation(JPA.ID_CLASS); assertEquals(ID_CLASS_VALUE, idClass.getValue()); @@ -98,7 +98,7 @@ public class IdClassTests extends JavaResourceModelTestCase { public void testGetFullyQualifiedClass() throws Exception { IType testType = this.createTestIdClassWithValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); IdClass idClass = (IdClass) typeResource.annotation(JPA.ID_CLASS); assertNotNull(idClass.getValue()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java index e48e4b4d76..b91b2fb7c7 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/IdTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.Id; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class IdTests extends JavaResourceModelTestCase { @@ -40,10 +40,10 @@ public class IdTests extends JavaResourceModelTestCase { public void testId() throws Exception { IType testType = this.createTestId(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResource mappingAnnotation = attributeResource.mappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.mappingAnnotation(); assertTrue(mappingAnnotation instanceof Id); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java index fab5e57c33..d9befe5b21 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/InheritanceTests.java @@ -11,10 +11,10 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.Inheritance; -import org.eclipse.jpt.core.internal.resource.java.InheritanceType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; +import org.eclipse.jpt.core.resource.java.Inheritance; +import org.eclipse.jpt.core.resource.java.InheritanceType; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class InheritanceTests extends JavaResourceModelTestCase { @@ -55,7 +55,7 @@ public class InheritanceTests extends JavaResourceModelTestCase { public void testInheritance() throws Exception { IType testType = this.createTestInheritance(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); Inheritance inheritance = (Inheritance) typeResource.annotation(JPA.INHERITANCE); assertNotNull(inheritance); @@ -63,7 +63,7 @@ public class InheritanceTests extends JavaResourceModelTestCase { public void testGetStrategy() throws Exception { IType testType = this.createTestInheritanceWithStrategy(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); Inheritance inheritance = (Inheritance) typeResource.annotation(JPA.INHERITANCE); assertEquals(InheritanceType.JOINED, inheritance.getStrategy()); @@ -71,7 +71,7 @@ public class InheritanceTests extends JavaResourceModelTestCase { public void testSetStrategy() throws Exception { IType testType = this.createTestInheritance(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); Inheritance inheritance = (Inheritance) typeResource.annotation(JPA.INHERITANCE); inheritance.setStrategy(InheritanceType.TABLE_PER_CLASS); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentAttributeResourceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentAttributeResourceTests.java index 27d78ca979..1b3b275cf3 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentAttributeResourceTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentAttributeResourceTests.java @@ -14,17 +14,17 @@ import java.util.Iterator; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.AttributeOverride; -import org.eclipse.jpt.core.internal.resource.java.Basic; -import org.eclipse.jpt.core.internal.resource.java.Column; -import org.eclipse.jpt.core.internal.resource.java.Id; import org.eclipse.jpt.core.internal.resource.java.IdImpl; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.OneToMany; import org.eclipse.jpt.core.internal.resource.java.OneToOneImpl; +import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation; +import org.eclipse.jpt.core.resource.java.Basic; +import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.Id; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.OneToMany; import org.eclipse.jpt.utility.internal.ClassTools; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -339,38 +339,38 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testJavaAttributeAnnotations() throws Exception { IType testType = this.createTestEntityWithColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertEquals(1, attributeResource.annotationsSize()); } public void testJavaAttributeAnnotation() throws Exception { IType testType = this.createTestEntityWithColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertNotNull(attributeResource.annotation(JPA.COLUMN)); } public void testJavaAttributeAnnotationNull() throws Exception { IType testType = this.createTestEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertNull(attributeResource.annotation(JPA.TABLE)); } //This will result in a compilation error, but we assume the first column found public void testDuplicateAnnotations() throws Exception { IType testType = this.createTestEntityMultipleColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - Column columnResource = (Column) attributeResource.annotation(JPA.COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + ColumnAnnotation columnResource = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals("FOO", columnResource.getName()); } public void testRemoveColumn() throws Exception { IType testType = this.createTestEntityWithColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); attributeResource.removeAnnotation(JPA.COLUMN); assertSourceDoesNotContain("@Column"); @@ -378,10 +378,10 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testRemoveColumnName() throws Exception { IType testType = this.createTestEntityWithColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - Column columnResource = (Column) attributeResource.annotation(JPA.COLUMN); + ColumnAnnotation columnResource = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); columnResource.setTable(null); assertSourceContains("@Column(name=\"FOO\")"); @@ -395,15 +395,15 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testMultipleAttributeMappings() throws Exception { IType testType = this.createTestEntityWithIdAndBasic(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertEquals(2, attributeResource.mappingAnnotationsSize()); assertEquals(0, attributeResource.annotationsSize()); assertNotNull(attributeResource.mappingAnnotation(JPA.BASIC)); assertNotNull(attributeResource.mappingAnnotation(JPA.ID)); - JavaResource javaAttributeMappingAnnotation = attributeResource.mappingAnnotation(); + JavaResourceNode javaAttributeMappingAnnotation = attributeResource.mappingAnnotation(); assertTrue(javaAttributeMappingAnnotation instanceof Basic); assertSourceContains("@Basic"); assertSourceContains("@Id"); @@ -419,8 +419,8 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testSetJavaAttributeMappingAnnotation() throws Exception { IType testType = createTestType(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertEquals(0, attributeResource.mappingAnnotationsSize()); attributeResource.setMappingAnnotation(JPA.ID); @@ -430,8 +430,8 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testSetJavaAttributeMappingAnnotation2() throws Exception { IType testType = createTestEntityWithColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertNull(attributeResource.mappingAnnotation()); attributeResource.setMappingAnnotation(JPA.ID); @@ -443,8 +443,8 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testSetJavaAttributeMappingAnnotation3() throws Exception { IType testType = createTestEntityWithIdColumnGeneratedValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertTrue(attributeResource.mappingAnnotation() instanceof Id); attributeResource.setMappingAnnotation(JPA.BASIC); @@ -457,8 +457,8 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testSetJavaAttributeMappingAnnotationNull() throws Exception { IType testType = createTestEntityWithIdColumnGeneratedValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertTrue(attributeResource.mappingAnnotation() instanceof Id); attributeResource.setMappingAnnotation(null); @@ -471,9 +471,9 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testAddJavaAttributeAnnotation() throws Exception { IType testType = createTestEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertSourceDoesNotContain("@Column"); attributeResource.addAnnotation(JPA.COLUMN); @@ -482,8 +482,8 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testRemoveJavaAttributeAnnotation() throws Exception { IType testType = createTestEntityAnnotatedField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertSourceContains("@Column"); attributeResource.removeAnnotation(JPA.COLUMN); assertSourceDoesNotContain("@Column"); @@ -493,8 +493,8 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC //update source code to change from @Id to @OneToOne and make sure @Column is not removed public void testChangeAttributeMappingInSource() throws Exception { IType jdtType = createTestEntityAnnotatedField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); idField().removeAnnotation(((IdImpl) attributeResource.mappingAnnotation()).getDeclarationAnnotationAdapter()); @@ -514,50 +514,50 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testJavaAttributeAnnotationsNestable() throws Exception { IType jdtType = createTestEmbeddedWithAttributeOverride(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertEquals(1, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); assertEquals("FOO", attributeOverride.getName()); } public void testJavaAttributeAnnotationsNoNestable() throws Exception { IType jdtType = createTestEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertEquals(0, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } public void testJavaAttributeAnnotationsContainerNoNestable() throws Exception { IType jdtType = createTestEmbeddedWithAttributeOverridesEmpty(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertEquals(0, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } public void testJavaAttributeAnnotationsNestableAndContainer() throws Exception { IType jdtType = createTestEmbeddedWithAttributeOverrideAndAttributeOverrides(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE)); assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES)); assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); - AttributeOverride attributeOverrideResource = (AttributeOverride) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); assertEquals("BAR", attributeOverrideResource.getName()); } // -->> @AttributeOverride(name="FOO") public void testAddJavaAttributeAnnotationNestableContainer() throws Exception { IType jdtType = createTestEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); assertSourceContains("@AttributeOverride(name=\"FOO\")"); } @@ -566,10 +566,10 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC // @AttributeOverride(name="FOO") @AttributeOverrides({@AttributeOverride(name="FOO"), @AttributeOverride(name="BAR")}) public void testAddJavaAttributeAnnotationNestableContainer2() throws Exception { IType jdtType = createTestEmbeddedWithAttributeOverride(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\"),@AttributeOverride(name=\"BAR\")})"); @@ -586,10 +586,10 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC // @AttributeOverrides({@AttributeOverride(name="FOO"), @AttributeOverride(name="BAR")}) public void testAddJavaAttributeAnnotationNestableContainer3() throws Exception { IType jdtType = createTestEmbeddedWithAttributeOverrides(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\"),@AttributeOverride(name=\"BAR\")})"); @@ -600,10 +600,10 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testAddJavaAttributeAnnotationNestableContainer5() throws Exception { IType jdtType = createTestEmbeddedWithAttributeOverrides(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("BAR"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"BAR\"),@AttributeOverride(name=\"FOO\")})"); @@ -622,14 +622,14 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC // @AttributeOverrides({@AttributeOverride(name=\"BAR\"), @AttributeOverride(name=\"BAZ\"), @AttributeOverride(name=\"BOO\")}) public void testAddJavaAttributeAnnotationNestableContainer4() throws Exception { IType jdtType = createTestEmbeddedWithAttributeOverrideAndAttributeOverrides(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDE)); assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES)); assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); - AttributeOverride attributeOverride = (AttributeOverride) attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"BAR\"), @AttributeOverride(name=\"BAZ\"),"); assertSourceContains("@AttributeOverride})"); attributeOverride.setName("BOO"); @@ -638,12 +638,12 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC assertNotNull(attributeResource.annotation(JPA.ATTRIBUTE_OVERRIDES)); assertEquals(3, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); - Iterator<JavaResource> attributeOverrideAnnotations = attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); - attributeOverride = (AttributeOverride) attributeOverrideAnnotations.next(); + Iterator<JavaResourceNode> attributeOverrideAnnotations = attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeOverride = (AttributeOverrideAnnotation) attributeOverrideAnnotations.next(); assertEquals("BAR", attributeOverride.getName()); - attributeOverride = (AttributeOverride) attributeOverrideAnnotations.next(); + attributeOverride = (AttributeOverrideAnnotation) attributeOverrideAnnotations.next(); assertEquals("BAZ", attributeOverride.getName()); - attributeOverride = (AttributeOverride) attributeOverrideAnnotations.next(); + attributeOverride = (AttributeOverrideAnnotation) attributeOverrideAnnotations.next(); assertEquals("BOO", attributeOverride.getName()); assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"BAR\"), @AttributeOverride(name=\"BAZ\"),"); @@ -654,8 +654,8 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC //@AttributeOverride(name="FOO") public void testRemoveJavaAttributeAnnotationNestableContainer() throws Exception { IType jdtType = createTestEmbeddedWithAttributeOverride(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); @@ -667,8 +667,8 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC //@SecondaryTables(@SecondaryTable(name="FOO")) public void testRemoveJavaAttributeAnnotationNestableContainer2() throws Exception { IType jdtType = createTestEmbeddedWithAttributeOverrides(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); @@ -678,8 +678,8 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testRemoveJavaAttributeAnnotationIndex() throws Exception { IType jdtType = createTestEmbeddedWith2AttributeOverrides(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE , JPA.ATTRIBUTE_OVERRIDES); @@ -690,10 +690,10 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testRemoveJavaAttributeAnnotationIndex2() throws Exception { IType jdtType = createTestEmbeddedWith2AttributeOverrides(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverride newAnnotation = (AttributeOverride)attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation)attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); newAnnotation.setName("BAZ"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\"), @AttributeOverride(name=\"BAR\"),"); assertSourceContains("@AttributeOverride(name=\"BAZ\")})"); @@ -704,10 +704,10 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testMoveJavaTypeAnnotation() throws Exception { IType jdtType = createTestEmbeddedWith2AttributeOverrides(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverride newAnnotation = (AttributeOverride)attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation)attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); newAnnotation.setName("BAZ"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\"), @AttributeOverride(name=\"BAR\"),"); assertSourceContains("@AttributeOverride(name=\"BAZ\")})"); @@ -720,10 +720,10 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testMoveJavaTypeAnnotation2() throws Exception { IType jdtType = createTestEmbeddedWith2AttributeOverrides(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverride newAnnotation = (AttributeOverride) attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation) attributeResource.addAnnotation(2, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); newAnnotation.setName("BAZ"); assertSourceContains("@AttributeOverrides({@AttributeOverride(name=\"FOO\"), @AttributeOverride(name=\"BAR\"),"); assertSourceContains("@AttributeOverride(name=\"BAZ\")})"); @@ -736,17 +736,17 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC //more detailed tests in JPTToolsTests public void testIsPersistableField() throws Exception { IType jdtType = createTestEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertTrue(attributeResource.isPersistable()); } public void testIsPersistableField2() throws Exception { IType jdtType = createTestEntityWithNonResolvingField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - Collection<JavaPersistentAttributeResource> attributes = (Collection<JavaPersistentAttributeResource>) ClassTools.fieldValue(typeResource, "attributes"); - JavaPersistentAttributeResource attributeResource = attributes.iterator().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + Collection<JavaResourcePersistentAttribute> attributes = (Collection<JavaResourcePersistentAttribute>) ClassTools.fieldValue(typeResource, "attributes"); + JavaResourcePersistentAttribute attributeResource = attributes.iterator().next(); assertEquals("foo", attributeResource.getName()); assertTrue(attributeResource.isForField()); @@ -760,9 +760,9 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC public void testGetQualifiedTypeName() throws Exception { IType jdtType = createTestEntityWithNonResolvingField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - Collection<JavaPersistentAttributeResource> attributes = (Collection<JavaPersistentAttributeResource>) ClassTools.fieldValue(typeResource, "attributes"); - JavaPersistentAttributeResource attributeResource = attributes.iterator().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + Collection<JavaResourcePersistentAttribute> attributes = (Collection<JavaResourcePersistentAttribute>) ClassTools.fieldValue(typeResource, "attributes"); + JavaResourcePersistentAttribute attributeResource = attributes.iterator().next(); assertEquals("foo", attributeResource.getName()); assertNull(attributeResource.getQualifiedTypeName()); @@ -777,17 +777,17 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC //more detailed tests in JPTToolsTests public void testIsPersistableMethod() throws Exception { IType jdtType = createTestEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.properties().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.properties().next(); assertTrue(attributeResource.isPersistable()); } public void testIsPersistableMethod2() throws Exception { IType jdtType = createTestEntityWithNonResolvingMethod(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - Collection<JavaPersistentAttributeResource> attributes = (Collection<JavaPersistentAttributeResource>) ClassTools.fieldValue(typeResource, "attributes"); - JavaPersistentAttributeResource attributeResource = (JavaPersistentAttributeResource) attributes.toArray()[3]; + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + Collection<JavaResourcePersistentAttribute> attributes = (Collection<JavaResourcePersistentAttribute>) ClassTools.fieldValue(typeResource, "attributes"); + JavaResourcePersistentAttribute attributeResource = (JavaResourcePersistentAttribute) attributes.toArray()[3]; assertEquals("foo", attributeResource.getName()); assertTrue(attributeResource.isForProperty()); @@ -804,16 +804,16 @@ public class JavaPersistentAttributeResourceTests extends JavaResourceModelTestC //thing to do with JPA beyond the most basic things that use default column names public void testMultipleVariableDeclarationsPerLine() throws Exception { IType jdtType = createTestEntityMultipleVariableDeclarationsPerLine(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); assertEquals(4, CollectionTools.size(typeResource.fields())); - Iterator<JavaPersistentAttributeResource> fields = typeResource.fields(); - JavaPersistentAttributeResource attributeResource = fields.next(); - Column column = (Column) attributeResource.annotation(JPA.COLUMN); + Iterator<JavaResourcePersistentAttribute> fields = typeResource.fields(); + JavaResourcePersistentAttribute attributeResource = fields.next(); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals("baz", column.getName()); attributeResource = fields.next(); - column = (Column) attributeResource.annotation(JPA.COLUMN); + column = (ColumnAnnotation) attributeResource.annotation(JPA.COLUMN); assertEquals("baz", column.getName()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentTypeResourceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentTypeResourceTests.java index 71bd46d69d..f2e18081cb 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentTypeResourceTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaPersistentTypeResourceTests.java @@ -14,18 +14,18 @@ import java.util.List; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.AccessType; -import org.eclipse.jpt.core.internal.resource.java.Embeddable; import org.eclipse.jpt.core.internal.resource.java.EmbeddableImpl; -import org.eclipse.jpt.core.internal.resource.java.Entity; import org.eclipse.jpt.core.internal.resource.java.EntityImpl; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.MappedSuperclass; -import org.eclipse.jpt.core.internal.resource.java.SecondaryTable; -import org.eclipse.jpt.core.internal.resource.java.Table; +import org.eclipse.jpt.core.resource.java.AccessType; +import org.eclipse.jpt.core.resource.java.EmbeddableAnnotation; +import org.eclipse.jpt.core.resource.java.EntityAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation; +import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation; +import org.eclipse.jpt.core.resource.java.TableAnnotation; import org.eclipse.jpt.utility.internal.ClassTools; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -487,33 +487,33 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testJavaTypeAnnotations() throws Exception { IType testType = this.createTestEntityWithTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); assertEquals(1, typeResource.annotationsSize()); } public void testJavaTypeAnnotation() throws Exception { IType testType = this.createTestEntityWithTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); assertNotNull(typeResource.annotation(JPA.TABLE)); } public void testJavaTypeAnnotationNull() throws Exception { IType testType = this.createTestEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); assertNull(typeResource.annotation(JPA.TABLE)); } //This will result in a compilation error, but we assume the first table found public void testDuplicateAnnotations() throws Exception { IType testType = this.createTestEntityMultipleTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - Table tableResource = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + TableAnnotation tableResource = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertEquals("FOO", tableResource.getName()); } public void testRemoveTable() throws Exception { IType testType = this.createTestEntityWithTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); typeResource.removeAnnotation(JPA.TABLE); assertSourceDoesNotContain("@Table"); @@ -521,9 +521,9 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testRemoveTableName() throws Exception { IType testType = this.createTestEntityWithTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Table tableResource = (Table) typeResource.annotation(JPA.TABLE); + TableAnnotation tableResource = (TableAnnotation) typeResource.annotation(JPA.TABLE); tableResource.setSchema(null); assertSourceContains("@Table(name=\"FOO\")"); @@ -537,22 +537,22 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testMultipleTypeMappings() throws Exception { IType testType = this.createTestEntityWithEmbeddable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); assertEquals(2, typeResource.mappingAnnotationsSize()); assertEquals(0, typeResource.annotationsSize()); assertNotNull(typeResource.mappingAnnotation(JPA.EMBEDDABLE)); assertNotNull(typeResource.mappingAnnotation(JPA.ENTITY)); - JavaResource javaTypeMappingAnnotation = typeResource.mappingAnnotation(); - assertTrue(javaTypeMappingAnnotation instanceof Embeddable); + JavaResourceNode javaTypeMappingAnnotation = typeResource.mappingAnnotation(); + assertTrue(javaTypeMappingAnnotation instanceof EmbeddableAnnotation); assertSourceContains("@Entity"); assertSourceContains("@Embeddable"); typeResource.setMappingAnnotation(JPA.MAPPED_SUPERCLASS); assertEquals(1, typeResource.mappingAnnotationsSize()); javaTypeMappingAnnotation = typeResource.mappingAnnotation(); - assertTrue(javaTypeMappingAnnotation instanceof MappedSuperclass); + assertTrue(javaTypeMappingAnnotation instanceof MappedSuperclassAnnotation); assertSourceDoesNotContain("@Entity"); assertSourceContains("@MappedSuperclass"); assertSourceDoesNotContain("@Embeddable"); @@ -560,21 +560,21 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testSetJavaTypeMappingAnnotation() throws Exception { IType testType = createTestType(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); assertEquals(0, typeResource.mappingAnnotationsSize()); typeResource.setMappingAnnotation(JPA.ENTITY); - assertTrue(typeResource.mappingAnnotation() instanceof Entity); + assertTrue(typeResource.mappingAnnotation() instanceof EntityAnnotation); assertSourceContains("@Entity"); } public void testSetJavaTypeMappingAnnotation2() throws Exception { IType testType = createTestEntityWithTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - assertTrue(typeResource.mappingAnnotation() instanceof Entity); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + assertTrue(typeResource.mappingAnnotation() instanceof EntityAnnotation); typeResource.setMappingAnnotation(JPA.EMBEDDABLE); - assertTrue(typeResource.mappingAnnotation() instanceof Embeddable); + assertTrue(typeResource.mappingAnnotation() instanceof EmbeddableAnnotation); assertSourceDoesNotContain("@Entity"); assertSourceContains("@Table"); @@ -582,7 +582,7 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testAddJavaTypeAnnotation() throws Exception { IType testType = createTestEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); assertSourceDoesNotContain("@Table"); typeResource.addAnnotation(JPA.TABLE); @@ -592,7 +592,7 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testRemoveJavaTypeAnnotation() throws Exception { IType testType = createTestEntityWithTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); assertSourceContains("@Table"); typeResource.removeAnnotation(JPA.TABLE); assertSourceDoesNotContain("@Table"); @@ -602,7 +602,7 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { //update source code to change from @Entity to @Embeddable and make sure @Table is not removed public void testChangeTypeMappingInSource() throws Exception { IType jdtType = createTestEntityWithTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); testType().removeAnnotation(((EntityImpl) typeResource.mappingAnnotation()).getDeclarationAnnotationAdapter()); @@ -622,38 +622,38 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testJavaTypeAnnotationsNestable() throws Exception { IType jdtType = createTestEntityWithSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); assertEquals(1, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals("FOO", secondaryTableResource.getName()); } public void testJavaTypeAnnotationsNoNestable() throws Exception { IType jdtType = createTestEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); assertEquals(0, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testJavaTypeAnnotationsContainerNoNestable() throws Exception { IType jdtType = createTestEntityWithEmptySecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); assertEquals(0, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testJavaTypeAnnotationsNestableAndContainer() throws Exception { IType jdtType = createTestEntityWithSecondaryTableAndSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLE)); assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES)); assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals("BAR", secondaryTableResource.getName()); } @@ -661,8 +661,8 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { // @SecondaryTable(name="FOO") public void testAddJavaTypeAnnotationNestableContainer() throws Exception { IType jdtType = createTestEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("FOO"); assertSourceContains("@SecondaryTable(name=\"FOO\")"); } @@ -671,9 +671,9 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { // @SecondaryTable(name="FOO") @SecondaryTables({@SecondaryTable(name="FOO"), @SecondaryTable(name="BAR")}) public void testAddJavaTypeAnnotationNestableContainer2() throws Exception { IType jdtType = createTestEntityWithSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\"),@SecondaryTable(name=\"BAR\")})"); @@ -690,9 +690,9 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { // @SecondaryTables({@SecondaryTable(name="FOO"), @SecondaryTable(name="BAR")}) public void testAddJavaTypeAnnotationNestableContainer3() throws Exception { IType jdtType = createTestEntityWithSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\"),@SecondaryTable(name=\"BAR\")})"); @@ -703,9 +703,9 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testAddJavaTypeAnnotationNestableContainer5() throws Exception { IType jdtType = createTestEntityWithSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAR\"),@SecondaryTable(name=\"FOO\")})"); @@ -716,9 +716,9 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testAddJavaTypeAnnotationNestableContainer6() throws Exception { IType jdtType = createTestEntityWithSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAR\"),@SecondaryTable(name=\"FOO\")})"); @@ -726,7 +726,7 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES)); assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("BAZ"); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAZ\"),@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"FOO\")})"); @@ -743,13 +743,13 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { // @SecondaryTables({@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\"), @SecondaryTable(name=\"BOO\")}) public void testAddJavaTypeAnnotationNestableContainer4() throws Exception { IType jdtType = createTestEntityWithSecondaryTableAndSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLE)); assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES)); assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - SecondaryTable secondaryTableResource = (SecondaryTable) typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\"), @SecondaryTable})"); secondaryTableResource.setName("BOO"); @@ -757,12 +757,12 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES)); assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - Iterator<JavaResource> secondaryTableAnnotations = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); - secondaryTableResource = (SecondaryTable) secondaryTableAnnotations.next(); + Iterator<JavaResourceNode> secondaryTableAnnotations = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + secondaryTableResource = (SecondaryTableAnnotation) secondaryTableAnnotations.next(); assertEquals("BAR", secondaryTableResource.getName()); - secondaryTableResource = (SecondaryTable) secondaryTableAnnotations.next(); + secondaryTableResource = (SecondaryTableAnnotation) secondaryTableAnnotations.next(); assertEquals("BAZ", secondaryTableResource.getName()); - secondaryTableResource = (SecondaryTable) secondaryTableAnnotations.next(); + secondaryTableResource = (SecondaryTableAnnotation) secondaryTableAnnotations.next(); assertEquals("BOO", secondaryTableResource.getName()); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\"), @SecondaryTable(name=\"BOO\")})"); @@ -772,7 +772,7 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { //@SecondaryTable(name="FOO") public void testRemoveJavaTypeAnnotationNestableContainer() throws Exception { IType jdtType = createTestEntityWithSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); @@ -784,7 +784,7 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { //@SecondaryTables(@SecondaryTable(name="FOO")) public void testRemoveJavaTypeAnnotationNestableContainer2() throws Exception { IType jdtType = createTestEntityWithSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); @@ -794,7 +794,7 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testRemoveJavaTypeAnnotationIndex() throws Exception { IType jdtType = createTestEntityWith2SecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); @@ -805,9 +805,9 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testRemoveJavaTypeAnnotationIndex2() throws Exception { IType jdtType = createTestEntityWith2SecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - SecondaryTable newAnnotation = (SecondaryTable)typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); newAnnotation.setName("BAZ"); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\"), @SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\")})"); @@ -817,9 +817,9 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testMoveJavaTypeAnnotation() throws Exception { IType jdtType = createTestEntityWith2SecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - SecondaryTable newAnnotation = (SecondaryTable)typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); newAnnotation.setName("BAZ"); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\"), @SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\")})"); @@ -829,9 +829,9 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testMoveJavaTypeAnnotation2() throws Exception { IType jdtType = createTestEntityWith2SecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - SecondaryTable newAnnotation = (SecondaryTable)typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addAnnotation(2, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); newAnnotation.setName("BAZ"); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\"), @SecondaryTable(name=\"BAR\"), @SecondaryTable(name=\"BAZ\")})"); @@ -841,11 +841,11 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testNestedTypes() throws Exception { IType jdtType = createTestEntityWithMemberTypes(); - JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType); + JavaResourcePersistentType persistentType = buildJavaTypeResource(jdtType); assertEquals("only persistable types should be returned by nestedTypes()", 1, CollectionTools.size(persistentType.nestedTypes())); - List<JavaPersistentTypeResource> nestedTypes = (List<JavaPersistentTypeResource>) ClassTools.fieldValue(persistentType, "nestedTypes"); + List<JavaResourcePersistentType> nestedTypes = (List<JavaResourcePersistentType>) ClassTools.fieldValue(persistentType, "nestedTypes"); assertEquals(4, CollectionTools.size(nestedTypes)); @@ -853,14 +853,14 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testDuplicateEntityAnnotations() throws Exception { IType jdtType = createTestEntityDuplicates(); - JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType); + JavaResourcePersistentType persistentType = buildJavaTypeResource(jdtType); - Entity javaTypeMappingAnnotation = (Entity) persistentType.mappingAnnotation(JPA.ENTITY); + EntityAnnotation javaTypeMappingAnnotation = (EntityAnnotation) persistentType.mappingAnnotation(JPA.ENTITY); assertEquals("FirstEntity", javaTypeMappingAnnotation.getName()); assertEquals(1, persistentType.mappingAnnotationsSize()); - javaTypeMappingAnnotation = (Entity) persistentType.mappingAnnotation(); + javaTypeMappingAnnotation = (EntityAnnotation) persistentType.mappingAnnotation(); assertEquals("FirstEntity", javaTypeMappingAnnotation.getName()); } @@ -880,49 +880,49 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { public void testGetAccessNoAttributesAnnotated() throws Exception { IType jdtType = createTestEntity(); - JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType); + JavaResourcePersistentType persistentType = buildJavaTypeResource(jdtType); assertNull(persistentType.getAccess()); } public void testGetAccessFieldsAnnotated() throws Exception { IType jdtType = createTestEntityAnnotatedField(); - JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType); + JavaResourcePersistentType persistentType = buildJavaTypeResource(jdtType); assertEquals(AccessType.FIELD, persistentType.getAccess()); } public void testGetAccessMethodsAnnotated() throws Exception { IType jdtType = createTestEntityAnnotatedMethod(); - JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType); + JavaResourcePersistentType persistentType = buildJavaTypeResource(jdtType); assertEquals(AccessType.PROPERTY, persistentType.getAccess()); } public void testGetAccessFieldsAndMethodsAnnotated() throws Exception { IType jdtType = createTestEntityAnnotatedFieldAndMethod(); - JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType); + JavaResourcePersistentType persistentType = buildJavaTypeResource(jdtType); assertEquals(AccessType.FIELD, persistentType.getAccess()); } public void testGetAccessNonPersistableMethodAnnotated() throws Exception { IType jdtType = createTestEntityAnnotatedNonPersistableMethod(); - JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType); + JavaResourcePersistentType persistentType = buildJavaTypeResource(jdtType); assertNull(persistentType.getAccess()); } public void testGetAccessPersistableMethodAndNonPersistableFieldAnnotated() throws Exception { IType jdtType = createTestEntityAnnotatedPersistableMethodNonPersistableField(); - JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType); + JavaResourcePersistentType persistentType = buildJavaTypeResource(jdtType); assertEquals(AccessType.PROPERTY, persistentType.getAccess()); } public void testGetAccessNoPersistableFieldsAnnotated() throws Exception { IType jdtType = createTestEntityNoPersistableFields(); - JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType); + JavaResourcePersistentType persistentType = buildJavaTypeResource(jdtType); assertEquals(AccessType.PROPERTY, persistentType.getAccess()); } @@ -934,7 +934,7 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { //4. public void testGetSuperclassQualifiedName() throws Exception { IType jdtType = createTestEntity(); - JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType); + JavaResourcePersistentType persistentType = buildJavaTypeResource(jdtType); assertEquals("java.lang.Object", persistentType.getSuperClassQualifiedName()); @@ -943,29 +943,29 @@ public class JavaPersistentTypeResourceTests extends JavaResourceModelTestCase { //more detailed tests in JPTToolsTests public void testIsPersistable() throws Exception { IType jdtType = createTestEntity(); - JavaPersistentTypeResource persistentType = buildJavaTypeResource(jdtType); + JavaResourcePersistentType persistentType = buildJavaTypeResource(jdtType); assertTrue(persistentType.isPersistable()); } public void testAnnotatedMemberType() throws Exception { IType testType = this.createTestEntityWithMemberEmbeddable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); assertNotNull(typeResource.mappingAnnotation(JPA.ENTITY)); assertNull(typeResource.mappingAnnotation(JPA.EMBEDDABLE)); - JavaPersistentTypeResource nestedType = typeResource.nestedTypes().next(); + JavaResourcePersistentType nestedType = typeResource.nestedTypes().next(); assertNull(nestedType.mappingAnnotation(JPA.ENTITY)); assertNotNull(nestedType.mappingAnnotation(JPA.EMBEDDABLE)); } public void testInvalidAnnotations() throws Exception { IType testType = this.createTestInvalidAnnotations(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); assertEquals(0, typeResource.mappingAnnotationsSize()); assertEquals(0, typeResource.annotationsSize()); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertEquals(0, attributeResource.mappingAnnotationsSize()); assertEquals(0, attributeResource.annotationsSize()); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourceModelTestCase.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourceModelTestCase.java index ec8d1f2bb4..a66174eb62 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourceModelTestCase.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourceModelTestCase.java @@ -18,14 +18,14 @@ import org.eclipse.jdt.core.ElementChangedEvent; import org.eclipse.jdt.core.IElementChangedListener; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.core.internal.IContextModel; -import org.eclipse.jpt.core.internal.IJpaProject; -import org.eclipse.jpt.core.internal.JpaProject; -import org.eclipse.jpt.core.internal.JptCorePlugin; +import org.eclipse.jpt.core.ContextModel; +import org.eclipse.jpt.core.JpaProject; +import org.eclipse.jpt.core.JptCorePlugin; +import org.eclipse.jpt.core.internal.GenericJpaProject; import org.eclipse.jpt.core.internal.SimpleJpaProjectConfig; import org.eclipse.jpt.core.internal.jdtutility.NullAnnotationEditFormatter; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; import org.eclipse.jpt.core.internal.resource.java.JavaResourceModel; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; import org.eclipse.jpt.core.tests.internal.jdtutility.AnnotationTestCase; import org.eclipse.jpt.utility.internal.StringTools; @@ -79,12 +79,12 @@ public class JavaResourceModelTestCase extends AnnotationTestCase } //build up a dummy JpaProject that does not have JpaFiles in it and does not update from java changes - protected IJpaProject buildJpaProject() throws CoreException { + protected JpaProject buildJpaProject() throws CoreException { return new TestJpaProject(this.buildJpaProjectConfig(this.javaProject.getProject())); } - protected class TestJpaProject extends JpaProject { - protected TestJpaProject(IJpaProject.Config config) throws CoreException { + protected class TestJpaProject extends GenericJpaProject { + protected TestJpaProject(JpaProject.Config config) throws CoreException { super(config); } @@ -98,7 +98,7 @@ public class JavaResourceModelTestCase extends AnnotationTestCase } @Override - protected IContextModel buildContextModel() { + protected ContextModel buildContextModel() { return null; // no context model } @@ -109,7 +109,7 @@ public class JavaResourceModelTestCase extends AnnotationTestCase } - private IJpaProject.Config buildJpaProjectConfig(IProject project) { + private JpaProject.Config buildJpaProjectConfig(IProject project) { SimpleJpaProjectConfig config = new SimpleJpaProjectConfig(); config.setProject(project); config.setJpaPlatform(JptCorePlugin.jpaPlatform(project)); @@ -118,7 +118,7 @@ public class JavaResourceModelTestCase extends AnnotationTestCase return config; } - protected JavaPersistentTypeResource buildJavaTypeResource(IType testType) + protected JavaResourcePersistentType buildJavaTypeResource(IType testType) throws CoreException { this.javaResourceModel = buildJavaResourceModel(testType); this.javaResourceModel.resolveTypes(); @@ -130,7 +130,7 @@ public class JavaResourceModelTestCase extends AnnotationTestCase throw new IllegalStateException(); } IFile file = (IFile) testType.getResource(); - IJpaProject jpaProject = buildJpaProject(); + JpaProject jpaProject = buildJpaProject(); return new JavaResourceModel( file, jpaProject.jpaPlatform().annotationProvider(), diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java index 08ff3bcaeb..ecf420cb4b 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnTests.java @@ -11,10 +11,10 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JoinColumn; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class JoinColumnTests extends JavaResourceModelTestCase { @@ -126,18 +126,18 @@ public class JoinColumnTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestJoinColumnWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } public void testGetNull() throws Exception { IType testType = this.createTestJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getName()); assertNull(column.getNullable()); @@ -151,9 +151,9 @@ public class JoinColumnTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getName()); @@ -166,9 +166,9 @@ public class JoinColumnTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestJoinColumnWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertEquals(COLUMN_NAME, column.getName()); @@ -180,17 +180,17 @@ public class JoinColumnTests extends JavaResourceModelTestCase { public void testGetTable() throws Exception { IType testType = this.createTestJoinColumnWithTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertEquals(COLUMN_TABLE, column.getTable()); } public void testSetTable() throws Exception { IType testType = this.createTestJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getTable()); @@ -207,17 +207,17 @@ public class JoinColumnTests extends JavaResourceModelTestCase { public void testGetReferencedColumnName() throws Exception { IType testType = this.createTestJoinColumnWithReferencedColumnName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName()); } public void testSetReferencedColumnName() throws Exception { IType testType = this.createTestJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getReferencedColumnName()); @@ -234,17 +234,17 @@ public class JoinColumnTests extends JavaResourceModelTestCase { public void testGetColumnDefinition() throws Exception { IType testType = this.createTestJoinColumnWithColumnDefinition(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } public void testSetColumnDefinition() throws Exception { IType testType = this.createTestJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -261,18 +261,18 @@ public class JoinColumnTests extends JavaResourceModelTestCase { public void testGetUnique() throws Exception { IType testType = this.createTestJoinColumnWithBooleanElement("unique"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertTrue(column.getUnique()); } public void testSetUnique() throws Exception { IType testType = this.createTestJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getUnique()); @@ -288,18 +288,18 @@ public class JoinColumnTests extends JavaResourceModelTestCase { public void testGetNullable() throws Exception { IType testType = this.createTestJoinColumnWithBooleanElement("nullable"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertTrue(column.getNullable()); } public void testSetNullable() throws Exception { IType testType = this.createTestJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getNullable()); @@ -315,18 +315,18 @@ public class JoinColumnTests extends JavaResourceModelTestCase { public void testGetInsertable() throws Exception { IType testType = this.createTestJoinColumnWithBooleanElement("insertable"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertTrue(column.getInsertable()); } public void testSetInsertable() throws Exception { IType testType = this.createTestJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getInsertable()); @@ -342,18 +342,18 @@ public class JoinColumnTests extends JavaResourceModelTestCase { public void testGetUpdatable() throws Exception { IType testType = this.createTestJoinColumnWithBooleanElement("updatable"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertTrue(column.getUpdatable()); } public void testSetUpdatable() throws Exception { IType testType = this.createTestJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotation(JPA.JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getUpdatable()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java index 50771617a2..23b62acaac 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinColumnsTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.JoinColumn; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -148,18 +148,18 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestJoinColumnWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } public void testGetNull() throws Exception { IType testType = this.createTestJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getName()); assertNull(column.getNullable()); @@ -172,9 +172,9 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getName()); @@ -187,9 +187,9 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestJoinColumnWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertEquals(COLUMN_NAME, column.getName()); @@ -201,17 +201,17 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testGetTable() throws Exception { IType testType = this.createTestJoinColumnWithTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertEquals(COLUMN_TABLE, column.getTable()); } public void testSetTable() throws Exception { IType testType = this.createTestJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getTable()); @@ -228,17 +228,17 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testGetReferencedColumnName() throws Exception { IType testType = this.createTestJoinColumnWithReferencedColumnName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName()); } public void testSetReferencedColumnName() throws Exception { IType testType = this.createTestJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getReferencedColumnName()); @@ -255,17 +255,17 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testGetColumnDefinition() throws Exception { IType testType = this.createTestJoinColumnWithColumnDefinition(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } public void testSetColumnDefinition() throws Exception { IType testType = this.createTestJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -282,18 +282,18 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testGetUnique() throws Exception { IType testType = this.createTestJoinColumnWithBooleanElement("unique"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertTrue(column.getUnique()); } public void testSetUnique() throws Exception { IType testType = this.createTestJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getUnique()); @@ -309,18 +309,18 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testGetNullable() throws Exception { IType testType = this.createTestJoinColumnWithBooleanElement("nullable"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertTrue(column.getNullable()); } public void testSetNullable() throws Exception { IType testType = this.createTestJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getNullable()); @@ -336,18 +336,18 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testGetInsertable() throws Exception { IType testType = this.createTestJoinColumnWithBooleanElement("insertable"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertTrue(column.getInsertable()); } public void testSetInsertable() throws Exception { IType testType = this.createTestJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getInsertable()); @@ -363,18 +363,18 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testGetUpdatable() throws Exception { IType testType = this.createTestJoinColumnWithBooleanElement("updatable"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertTrue(column.getUpdatable()); } public void testSetUpdatable() throws Exception { IType testType = this.createTestJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - JoinColumn column = (JoinColumn) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getUpdatable()); @@ -392,10 +392,10 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testAddJoinColumnCopyExisting() throws Exception { IType jdtType = createTestJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumn joinColumn = (JoinColumn) attributeResource.addAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("FOO"); assertSourceContains("@JoinColumns({@JoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"),@JoinColumn(name=\"FOO\")})"); @@ -406,21 +406,21 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testAddJoinColumnToBeginningOfList() throws Exception { IType jdtType = createTestJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumn joinColumn = (JoinColumn) attributeResource.addAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("FOO"); assertSourceContains("@JoinColumns({@JoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"),@JoinColumn(name=\"FOO\")})"); - joinColumn = (JoinColumn) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("BAZ"); assertSourceContains("@JoinColumns({@JoinColumn(name=\"BAZ\"),@JoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"), @JoinColumn(name=\"FOO\")})"); - Iterator<JavaResource> joinColumns = attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); - assertEquals("BAZ", ((JoinColumn) joinColumns.next()).getName()); - assertEquals("BAR", ((JoinColumn) joinColumns.next()).getName()); - assertEquals("FOO", ((JoinColumn) joinColumns.next()).getName()); + Iterator<JavaResourceNode> joinColumns = attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + assertEquals("BAZ", ((JoinColumnAnnotation) joinColumns.next()).getName()); + assertEquals("BAR", ((JoinColumnAnnotation) joinColumns.next()).getName()); + assertEquals("FOO", ((JoinColumnAnnotation) joinColumns.next()).getName()); assertNull(attributeResource.annotation(JPA.JOIN_COLUMN)); assertNotNull(attributeResource.annotation(JPA.JOIN_COLUMNS)); @@ -430,10 +430,10 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { public void testRemoveJoinColumnCopyExisting() throws Exception { IType jdtType = createTestJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumn joinColumn = (JoinColumn) attributeResource.addAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); joinColumn.setName("FOO"); assertSourceContains("@JoinColumns({@JoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\"),@JoinColumn(name=\"FOO\")})"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java index 8cc81d6ec5..df7e9d17af 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JoinTableTests.java @@ -13,11 +13,11 @@ import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JoinColumn; -import org.eclipse.jpt.core.internal.resource.java.JoinTable; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JoinColumnAnnotation; +import org.eclipse.jpt.core.resource.java.JoinTableAnnotation; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class JoinTableTests extends JavaResourceModelTestCase { @@ -153,20 +153,20 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestJoinTableWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertNotNull(table); assertEquals(TABLE_NAME, table.getName()); } public void testGetNull() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertNotNull(table); assertNull(table.getName()); assertNull(table.getCatalog()); @@ -175,10 +175,10 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertNotNull(table); assertNull(table.getName()); @@ -190,10 +190,10 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestJoinTableWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertEquals(TABLE_NAME, table.getName()); table.setName(null); @@ -204,20 +204,20 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testGetCatalog() throws Exception { IType testType = this.createTestJoinTableWithCatalog(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertNotNull(table); assertEquals(CATALOG_NAME, table.getCatalog()); } public void testSetCatalog() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertNotNull(table); assertNull(table.getCatalog()); @@ -229,10 +229,10 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testSetCatalogNull() throws Exception { IType testType = this.createTestJoinTableWithCatalog(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertEquals(CATALOG_NAME, table.getCatalog()); table.setCatalog(null); @@ -243,20 +243,20 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testGetSchema() throws Exception { IType testType = this.createTestJoinTableWithSchema(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertNotNull(table); assertEquals(SCHEMA_NAME, table.getSchema()); } public void testSetSchema() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertNotNull(table); assertNull(table.getSchema()); @@ -268,10 +268,10 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testSetSchemaNull() throws Exception { IType testType = this.createTestJoinTableWithSchema(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertEquals(SCHEMA_NAME, table.getSchema()); table.setSchema(null); @@ -282,20 +282,20 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testUniqueConstraints() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertEquals(0, table.uniqueConstraintsSize()); } public void testUniqueConstraints2() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); table.addUniqueConstraint(0); @@ -307,20 +307,20 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testUniqueConstraints3() throws Exception { IType testType = this.createTestJoinTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertEquals(3, table.uniqueConstraintsSize()); } public void testAddUniqueConstraint() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1); @@ -335,10 +335,10 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint() throws Exception { IType testType = this.createTestJoinTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next()); assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next()); assertEquals("BAZ", table.uniqueConstraintAt(2).columnNames().next()); @@ -362,10 +362,10 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint() throws Exception { IType testType = this.createTestJoinTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertSourceContains("@JoinTable(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"})})"); table.moveUniqueConstraint(2, 0); @@ -374,10 +374,10 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint2() throws Exception { IType testType = this.createTestJoinTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertSourceContains("@JoinTable(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"})})"); table.moveUniqueConstraint(0, 2); @@ -386,20 +386,20 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testJoinColumns() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertEquals(0, table.joinColumnsSize()); } public void testJoinColumns2() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); table.addJoinColumn(0); @@ -411,20 +411,20 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testJoinColumns3() throws Exception { IType testType = this.createTestJoinTableWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertEquals(2, table.joinColumnsSize()); } public void testAddJoinColumn() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); table.addJoinColumn(0).setName("FOO"); table.addJoinColumn(1); @@ -438,10 +438,10 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testRemoveJoinColumn() throws Exception { IType testType = this.createTestJoinTableWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); table.addJoinColumn(0).setName("FOO"); assertEquals("FOO", table.joinColumnAt(0).getName()); @@ -468,11 +468,11 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testMoveJoinColumn() throws Exception { IType testType = this.createTestJoinTableWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); - JoinColumn joinColumn = table.joinColumnAt(0); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); + JoinColumnAnnotation joinColumn = table.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); joinColumn.setNullable(Boolean.FALSE); @@ -494,12 +494,12 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testMoveJoinColumn2() throws Exception { IType testType = this.createTestJoinTableWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); - JoinColumn joinColumn = table.joinColumnAt(0); + JoinColumnAnnotation joinColumn = table.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); joinColumn.setNullable(Boolean.FALSE); @@ -523,15 +523,15 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testSetJoinColumnName() throws Exception { IType testType = this.createTestJoinTableWithJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); - ListIterator<JoinColumn> iterator = table.joinColumns(); + ListIterator<JoinColumnAnnotation> iterator = table.joinColumns(); assertEquals(2, table.joinColumnsSize()); - JoinColumn joinColumn = table.joinColumns().next(); + JoinColumnAnnotation joinColumn = table.joinColumns().next(); assertEquals("BAR", joinColumn.getName()); @@ -543,20 +543,20 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testInverseJoinColumns() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertEquals(0, table.inverseJoinColumnsSize()); } public void testInverseJoinColumns2() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(0); @@ -568,20 +568,20 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testInverseJoinColumns3() throws Exception { IType testType = this.createTestJoinTableWithInverseJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertEquals(2, table.inverseJoinColumnsSize()); } public void testAddInverseJoinColumn() throws Exception { IType testType = this.createTestJoinTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(0).setName("FOO"); table.addInverseJoinColumn(1); @@ -595,13 +595,13 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testRemoveInverseJoinColumn() throws Exception { IType testType = this.createTestJoinTableWithInverseJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(2).setName("FOO"); - Iterator<JoinColumn> inverseJoinColumns = table.inverseJoinColumns(); + Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns(); assertEquals("BAR", inverseJoinColumns.next().getName()); assertNull(inverseJoinColumns.next().getName()); assertEquals("FOO", inverseJoinColumns.next().getName()); @@ -626,13 +626,13 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testMoveInverseJoinColumn() throws Exception { IType testType = this.createTestJoinTableWithInverseJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(0).setName("FOO"); - Iterator<JoinColumn> inverseJoinColumns = table.inverseJoinColumns(); + Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns(); assertEquals("FOO", inverseJoinColumns.next().getName()); assertEquals("BAR", inverseJoinColumns.next().getName()); assertNull(inverseJoinColumns.next().getName()); @@ -648,13 +648,13 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testMoveInverseJoinColumn2() throws Exception { IType testType = this.createTestJoinTableWithInverseJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(1).setName("FOO"); - Iterator<JoinColumn> inverseJoinColumns = table.inverseJoinColumns(); + Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns(); assertEquals("BAR", inverseJoinColumns.next().getName()); assertEquals("FOO", inverseJoinColumns.next().getName()); assertNull(inverseJoinColumns.next().getName()); @@ -670,14 +670,14 @@ public class JoinTableTests extends JavaResourceModelTestCase { public void testSetInverseJoinColumnName() throws Exception { IType testType = this.createTestJoinTableWithInverseJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTable table = (JoinTable) attributeResource.annotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.annotation(JPA.JOIN_TABLE); assertEquals(2, table.inverseJoinColumnsSize()); - JoinColumn joinColumn = table.inverseJoinColumns().next(); + JoinColumnAnnotation joinColumn = table.inverseJoinColumns().next(); assertEquals("BAR", joinColumn.getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JpaCompilationUnitResourceTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JpaCompilationUnitResourceTests.java index 6e1d3714a7..8641273bd3 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JpaCompilationUnitResourceTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JpaCompilationUnitResourceTests.java @@ -14,12 +14,12 @@ import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.IJpaFile; -import org.eclipse.jpt.core.internal.IJpaProject; -import org.eclipse.jpt.core.internal.resource.java.Entity; -import org.eclipse.jpt.core.internal.resource.java.JPA; +import org.eclipse.jpt.core.JpaFile; +import org.eclipse.jpt.core.JpaProject; import org.eclipse.jpt.core.internal.resource.java.JavaResourceModel; import org.eclipse.jpt.core.internal.resource.java.JpaCompilationUnitResource; +import org.eclipse.jpt.core.resource.java.EntityAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; import org.eclipse.jpt.core.tests.internal.jdtutility.AnnotationTestCase; import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject; import org.eclipse.jpt.core.tests.internal.projects.TestJpaProject; @@ -61,8 +61,8 @@ public class JpaCompilationUnitResourceTests extends AnnotationTestCase { } protected JpaCompilationUnitResource getJpaCompilationUnitResource(ICompilationUnit testCompilationUnit) throws CoreException { - IJpaProject jpaProject = ((TestJpaProject) this.javaProject).getJpaProject(); - IJpaFile jpaFile = jpaProject.jpaFile((IFile) testCompilationUnit.getResource()); + JpaProject jpaProject = ((TestJpaProject) this.javaProject).getJpaProject(); + JpaFile jpaFile = jpaProject.jpaFile((IFile) testCompilationUnit.getResource()); JavaResourceModel javaResourceModel = (JavaResourceModel) jpaFile.getResourceModel(); return javaResourceModel.resource(); } @@ -71,7 +71,7 @@ public class JpaCompilationUnitResourceTests extends AnnotationTestCase { ICompilationUnit compilationUnit = this.createTestCompilationUnit(); JpaCompilationUnitResource jpaCompilationUnit = getJpaCompilationUnitResource(compilationUnit); - assertTrue(jpaCompilationUnit.getPersistentType().mappingAnnotation() instanceof Entity); + assertTrue(jpaCompilationUnit.getPersistentType().mappingAnnotation() instanceof EntityAnnotation); } } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java index 5eb4fb07c1..d14c0e3bb7 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/LobTests.java @@ -11,10 +11,10 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.Lob; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.Lob; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class LobTests extends JavaResourceModelTestCase { @@ -39,8 +39,8 @@ public class LobTests extends JavaResourceModelTestCase { public void testLob() throws Exception { IType testType = this.createTestLob(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Lob lob = (Lob) attributeResource.annotation(JPA.LOB); assertNotNull(lob); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java index 6424e4d000..9bc5bf0402 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToManyTests.java @@ -12,11 +12,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.FetchType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.ManyToMany; +import org.eclipse.jpt.core.resource.java.FetchType; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.ManyToMany; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class ManyToManyTests extends JavaResourceModelTestCase { @@ -131,8 +131,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testManyToMany() throws Exception { IType testType = this.createTestManyToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertNotNull(manyToMany); @@ -140,8 +140,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testGetFetch() throws Exception { IType testType = this.createTestManyToManyWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertEquals(FetchType.EAGER, manyToMany.getFetch()); @@ -149,8 +149,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testSetFetch() throws Exception { IType testType = this.createTestManyToManyWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertEquals(FetchType.EAGER, manyToMany.getFetch()); @@ -163,8 +163,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testSetFetchNull() throws Exception { IType testType = this.createTestManyToManyWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertEquals(FetchType.EAGER, manyToMany.getFetch()); @@ -178,8 +178,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testGetTargetEntity() throws Exception { IType testType = this.createTestManyToManyWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertEquals(TYPE_NAME, manyToMany.getTargetEntity()); @@ -187,8 +187,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testSetTargetEntity() throws Exception { IType testType = this.createTestManyToManyWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertEquals(TYPE_NAME, manyToMany.getTargetEntity()); @@ -200,8 +200,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testSetTargetEntityNull() throws Exception { IType testType = this.createTestManyToManyWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertEquals(TYPE_NAME, manyToMany.getTargetEntity()); @@ -215,8 +215,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testGetFullyQualifiedTargetEntity() throws Exception { IType testType = this.createTestManyToManyWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertEquals(FULLY_QUALIFIED_TYPE_NAME, manyToMany.getFullyQualifiedTargetEntity()); @@ -233,8 +233,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testGetMappedBy() throws Exception { IType testType = this.createTestManyToManyWithMappedBy(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertEquals("foo", manyToMany.getMappedBy()); @@ -242,8 +242,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testGetMappedByNull() throws Exception { IType testType = this.createTestManyToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertEquals(null, manyToMany.getMappedBy()); @@ -251,8 +251,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testSetMappedBy() throws Exception { IType testType = this.createTestManyToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertNull(manyToMany.getMappedBy()); @@ -264,8 +264,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testSetMappedByNull() throws Exception { IType testType = this.createTestManyToManyWithMappedBy(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertEquals("foo", manyToMany.getMappedBy()); @@ -279,8 +279,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testSetCascadeAll() throws Exception { IType testType = this.createTestManyToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadeAll()); @@ -294,8 +294,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testSetCascadeMerge() throws Exception { IType testType = this.createTestManyToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadeMerge()); @@ -309,8 +309,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testSetCascadePersist() throws Exception { IType testType = this.createTestManyToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadePersist()); @@ -324,8 +324,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testSetCascadeRemove() throws Exception { IType testType = this.createTestManyToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadeRemove()); @@ -339,8 +339,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testSetCascadeRefresh() throws Exception { IType testType = this.createTestManyToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadeRefresh()); @@ -354,8 +354,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testCascadeMoreThanOnce() throws Exception { IType testType = this.createTestManyToManyWithCascade(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertTrue(manyToMany.isCascadeAll()); @@ -379,8 +379,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testDuplicateCascade() throws Exception { IType testType = this.createTestManyToManyWithDuplicateCascade(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertTrue(manyToMany.isCascadeMerge()); @@ -397,8 +397,8 @@ public class ManyToManyTests extends JavaResourceModelTestCase { public void testMultipleCascade() throws Exception { IType testType = this.createTestManyToManyWithMultipleCascade(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToMany manyToMany = (ManyToMany) attributeResource.mappingAnnotation(JPA.MANY_TO_MANY); assertTrue(manyToMany.isCascadeMerge()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java index 82a2624cbf..0cb59a0256 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/ManyToOneTests.java @@ -12,11 +12,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.FetchType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.ManyToOne; +import org.eclipse.jpt.core.resource.java.FetchType; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.ManyToOne; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class ManyToOneTests extends JavaResourceModelTestCase { @@ -130,8 +130,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testManyToOne() throws Exception { IType testType = this.createTestManyToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertNotNull(manyToOne); @@ -139,8 +139,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testGetFetch() throws Exception { IType testType = this.createTestManyToOneWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertEquals(FetchType.EAGER, manyToOne.getFetch()); @@ -148,8 +148,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testSetFetch() throws Exception { IType testType = this.createTestManyToOneWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertEquals(FetchType.EAGER, manyToOne.getFetch()); @@ -162,8 +162,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testSetFetchNull() throws Exception { IType testType = this.createTestManyToOneWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertEquals(FetchType.EAGER, manyToOne.getFetch()); @@ -178,8 +178,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testGetTargetEntity() throws Exception { IType testType = this.createTestManyToOneWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertEquals(TYPE_NAME, manyToOne.getTargetEntity()); @@ -187,8 +187,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testSetTargetEntity() throws Exception { IType testType = this.createTestManyToOneWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertEquals(TYPE_NAME, manyToOne.getTargetEntity()); @@ -200,8 +200,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testSetTargetEntityNull() throws Exception { IType testType = this.createTestManyToOneWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertEquals(TYPE_NAME, manyToOne.getTargetEntity()); @@ -215,8 +215,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testGetFullyQualifiedTargetEntity() throws Exception { IType testType = this.createTestManyToOneWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertEquals(FULLY_QUALIFIED_TYPE_NAME, manyToOne.getFullyQualifiedTargetEntity()); @@ -233,8 +233,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testGetOptional() throws Exception { IType testType = this.createTestManyToOneWithOptional(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertTrue(manyToOne.getOptional()); @@ -242,8 +242,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testSetOptional() throws Exception { IType testType = this.createTestManyToOneWithOptional(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertTrue(manyToOne.getOptional()); @@ -256,8 +256,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testSetOptionalNull() throws Exception { IType testType = this.createTestManyToOneWithOptional(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertTrue(manyToOne.getOptional()); @@ -271,8 +271,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testSetCascadeAll() throws Exception { IType testType = this.createTestManyToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadeAll()); @@ -286,8 +286,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testSetCascadeMerge() throws Exception { IType testType = this.createTestManyToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadeMerge()); @@ -301,8 +301,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testSetCascadePersist() throws Exception { IType testType = this.createTestManyToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadePersist()); @@ -316,8 +316,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testSetCascadeRemove() throws Exception { IType testType = this.createTestManyToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadeRemove()); @@ -331,8 +331,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testSetCascadeRefresh() throws Exception { IType testType = this.createTestManyToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadeRefresh()); @@ -346,8 +346,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testCascadeMoreThanOnce() throws Exception { IType testType = this.createTestManyToOneWithCascade(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertTrue(manyToOne.isCascadeAll()); @@ -371,8 +371,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testDuplicateCascade() throws Exception { IType testType = this.createTestManyToOneWithDuplicateCascade(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertTrue(manyToOne.isCascadeMerge()); @@ -389,8 +389,8 @@ public class ManyToOneTests extends JavaResourceModelTestCase { public void testMultipleCascade() throws Exception { IType testType = this.createTestManyToOneWithMultipleCascade(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); ManyToOne manyToOne = (ManyToOne) attributeResource.mappingAnnotation(JPA.MANY_TO_ONE); assertTrue(manyToOne.isCascadeMerge()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java index de0297605c..352e3e377c 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MapKeyTests.java @@ -11,10 +11,10 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.MapKey; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.MapKey; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class MapKeyTests extends JavaResourceModelTestCase { @@ -53,8 +53,8 @@ public class MapKeyTests extends JavaResourceModelTestCase { public void testMapKey() throws Exception { IType testType = this.createTestMapKey(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); MapKey mapKey = (MapKey) attributeResource.annotation(JPA.MAP_KEY); assertNotNull(mapKey); @@ -62,8 +62,8 @@ public class MapKeyTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestMapKeyWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); MapKey mapKey = (MapKey) attributeResource.annotation(JPA.MAP_KEY); assertEquals("key", mapKey.getName()); @@ -71,8 +71,8 @@ public class MapKeyTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestMapKey(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); MapKey mapKey = (MapKey) attributeResource.annotation(JPA.MAP_KEY); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java index 3540e6cb34..e772e9bcf8 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/MappedSuperclassTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.Entity; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.MappedSuperclass; +import org.eclipse.jpt.core.resource.java.EntityAnnotation; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.MappedSuperclassAnnotation; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class MappedSuperclassTests extends JavaResourceModelTestCase { @@ -56,20 +56,20 @@ public class MappedSuperclassTests extends JavaResourceModelTestCase { public void testMappedSuperclass() throws Exception { IType testType = this.createTestMappedSuperclass(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - JavaResource mappingAnnotation = typeResource.mappingAnnotation(); - assertTrue(mappingAnnotation instanceof MappedSuperclass); + JavaResourceNode mappingAnnotation = typeResource.mappingAnnotation(); + assertTrue(mappingAnnotation instanceof MappedSuperclassAnnotation); } public void testMappedSuperclassAndEntity() throws Exception { IType testType = this.createTestMappedSuperclassAndEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - JavaResource mappingAnnotation = typeResource.mappingAnnotation(); - assertTrue(mappingAnnotation instanceof Entity); + JavaResourceNode mappingAnnotation = typeResource.mappingAnnotation(); + assertTrue(mappingAnnotation instanceof EntityAnnotation); - MappedSuperclass mappedSuperclass = (MappedSuperclass) typeResource.mappingAnnotation(JPA.MAPPED_SUPERCLASS); + MappedSuperclassAnnotation mappedSuperclass = (MappedSuperclassAnnotation) typeResource.mappingAnnotation(JPA.MAPPED_SUPERCLASS); assertNotNull(mappedSuperclass); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java index 2b94761b1c..c9d5847088 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueriesTests.java @@ -12,11 +12,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.NamedNativeQueries; -import org.eclipse.jpt.core.internal.resource.java.NamedNativeQuery; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NamedNativeQueries; +import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -133,28 +133,28 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testNamedNativeQuery() throws Exception { IType testType = this.createTestNamedNativeQueries(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertNotNull(namedQuery); } public void testGetName() throws Exception { IType testType = this.createTestNamedNativeQueryWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_NAME, namedQuery.getName()); } public void testSetName() throws Exception { IType testType = this.createTestNamedNativeQueryWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_NAME, namedQuery.getName()); namedQuery.setName("foo"); @@ -170,19 +170,19 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testGetQuery() throws Exception { IType testType = this.createTestNamedNativeQueryWithQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_QUERY, namedQuery.getQuery()); } public void testSetQuery() throws Exception { IType testType = this.createTestNamedNativeQueryWithQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_QUERY, namedQuery.getQuery()); namedQuery.setQuery("foo"); @@ -198,19 +198,19 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testGetResultClass() throws Exception { IType testType = this.createTestNamedNativeQueryWithResultClass(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass()); } public void testSetResultClass() throws Exception { IType testType = this.createTestNamedNativeQueryWithResultClass(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass()); namedQuery.setResultClass("foo"); @@ -226,10 +226,10 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testGetFullyQualifiedClass() throws Exception { IType testType = this.createTestNamedNativeQueryWithResultClass(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertNotNull(namedQuery.getResultClass()); assertNull(namedQuery.getFullyQualifiedResultClass()); @@ -242,19 +242,19 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testGetResultSetMapping() throws Exception { IType testType = this.createTestNamedNativeQueryWithResultSetMapping(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping()); } public void testSetResultSetMapping() throws Exception { IType testType = this.createTestNamedNativeQueryWithResultSetMapping(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping()); namedQuery.setResultSetMapping("foo"); @@ -270,20 +270,20 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testHints() throws Exception { IType testType = this.createTestNamedNativeQueries(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(0, namedQuery.hintsSize()); } public void testHints2() throws Exception { IType testType = this.createTestNamedNativeQueries(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0); namedQuery.addHint(1); @@ -294,20 +294,20 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testHints3() throws Exception { IType testType = this.createTestNamedNativeQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(2, namedQuery.hintsSize()); } public void testAddHint() throws Exception { IType testType = this.createTestNamedNativeQueries(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("FOO"); namedQuery.addHint(1); @@ -321,10 +321,10 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testRemoveHint() throws Exception { IType testType = this.createTestNamedNativeQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -351,10 +351,10 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testMoveHint() throws Exception { IType testType = this.createTestNamedNativeQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -374,10 +374,10 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testMoveHint2() throws Exception { IType testType = this.createTestNamedNativeQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedNativeQueries namedQueries = (NamedNativeQueries) typeResource.annotation(JPA.NAMED_NATIVE_QUERIES); - NamedNativeQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -397,9 +397,9 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testAddNamedNativeQueryCopyExisting() throws Exception { IType jdtType = createTestNamedNativeQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.addAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); namedQuery.setName("BAR"); assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"),@NamedNativeQuery(name=\"BAR\")})"); @@ -410,20 +410,20 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testAddNamedNativeQueryToBeginningOfList() throws Exception { IType jdtType = createTestNamedNativeQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.addAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); namedQuery.setName("BAR"); assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"),@NamedNativeQuery(name=\"BAR\")})"); - namedQuery = (NamedNativeQuery) typeResource.addAnnotation(0, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + namedQuery = (NamedNativeQueryAnnotation) typeResource.addAnnotation(0, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); namedQuery.setName("BAZ"); assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name=\"BAZ\"),@NamedNativeQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"), @NamedNativeQuery(name=\"BAR\")})"); - Iterator<JavaResource> namedQueries = typeResource.annotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); - assertEquals("BAZ", ((NamedNativeQuery) namedQueries.next()).getName()); - assertEquals("foo", ((NamedNativeQuery) namedQueries.next()).getName()); - assertEquals("BAR", ((NamedNativeQuery) namedQueries.next()).getName()); + Iterator<JavaResourceNode> namedQueries = typeResource.annotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + assertEquals("BAZ", ((NamedNativeQueryAnnotation) namedQueries.next()).getName()); + assertEquals("foo", ((NamedNativeQueryAnnotation) namedQueries.next()).getName()); + assertEquals("BAR", ((NamedNativeQueryAnnotation) namedQueries.next()).getName()); assertNull(typeResource.annotation(JPA.NAMED_NATIVE_QUERY)); assertNotNull(typeResource.annotation(JPA.NAMED_NATIVE_QUERIES)); @@ -432,9 +432,9 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { public void testRemoveNamedNativeQueryCopyExisting() throws Exception { IType jdtType = createTestNamedNativeQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.addAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); namedQuery.setName("BAR"); assertSourceContains("@NamedNativeQueries({@NamedNativeQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\"),@NamedNativeQuery(name=\"BAR\")})"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java index 7d8c13241d..2fe3be0e36 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedNativeQueryTests.java @@ -12,9 +12,9 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.NamedNativeQuery; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.NamedNativeQueryAnnotation; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class NamedNativeQueryTests extends JavaResourceModelTestCase { @@ -110,25 +110,25 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { public void testNamedNativeQuery() throws Exception { IType testType = this.createTestNamedNativeQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); assertNotNull(namedQuery); } public void testGetName() throws Exception { IType testType = this.createTestNamedNativeQueryWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_NAME, namedQuery.getName()); } public void testSetName() throws Exception { IType testType = this.createTestNamedNativeQueryWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_NAME, namedQuery.getName()); namedQuery.setName("foo"); @@ -144,17 +144,17 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { public void testGetQuery() throws Exception { IType testType = this.createTestNamedNativeQueryWithQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_QUERY, namedQuery.getQuery()); } public void testSetQuery() throws Exception { IType testType = this.createTestNamedNativeQueryWithQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_QUERY, namedQuery.getQuery()); namedQuery.setQuery("foo"); @@ -170,17 +170,17 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { public void testGetResultClass() throws Exception { IType testType = this.createTestNamedNativeQueryWithResultClass(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass()); } public void testSetResultClass() throws Exception { IType testType = this.createTestNamedNativeQueryWithResultClass(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass()); namedQuery.setResultClass("foo"); @@ -196,9 +196,9 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { public void testGetFullyQualifiedClass() throws Exception { IType testType = this.createTestNamedNativeQueryWithResultClass(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); assertNotNull(namedQuery.getResultClass()); assertNull(namedQuery.getFullyQualifiedResultClass()); @@ -211,17 +211,17 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { public void testGetResultSetMapping() throws Exception { IType testType = this.createTestNamedNativeQueryWithResultSetMapping(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping()); } public void testSetResultSetMapping() throws Exception { IType testType = this.createTestNamedNativeQueryWithResultSetMapping(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping()); namedQuery.setResultSetMapping("foo"); @@ -237,18 +237,18 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { public void testHints() throws Exception { IType testType = this.createTestNamedNativeQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); assertEquals(0, namedQuery.hintsSize()); } public void testHints2() throws Exception { IType testType = this.createTestNamedNativeQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0); namedQuery.addHint(1); @@ -259,9 +259,9 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { public void testHints3() throws Exception { IType testType = this.createTestNamedNativeQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); assertEquals(2, namedQuery.hintsSize()); } @@ -269,9 +269,9 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { public void testAddHint() throws Exception { IType testType = this.createTestNamedNativeQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0).setName("FOO"); namedQuery.addHint(1); @@ -285,9 +285,9 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { public void testRemoveHint() throws Exception { IType testType = this.createTestNamedNativeQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -314,9 +314,9 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { public void testMoveHint() throws Exception { IType testType = this.createTestNamedNativeQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0).setName("BAZ"); @@ -336,9 +336,9 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { public void testMoveHint2() throws Exception { IType testType = this.createTestNamedNativeQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedNativeQuery namedQuery = (NamedNativeQuery) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.annotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java index 09d0391f1d..50e8237682 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueriesTests.java @@ -12,11 +12,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.NamedQueries; -import org.eclipse.jpt.core.internal.resource.java.NamedQuery; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.NamedQueries; +import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -114,28 +114,28 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { public void testNamedQuery() throws Exception { IType testType = this.createTestNamedQueries(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES); - NamedQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertNotNull(namedQuery); } public void testGetName() throws Exception { IType testType = this.createTestNamedQueryWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES); - NamedQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_NAME, namedQuery.getName()); } public void testSetName() throws Exception { IType testType = this.createTestNamedQueryWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES); - NamedQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_NAME, namedQuery.getName()); namedQuery.setName("foo"); @@ -151,19 +151,19 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { public void testGetQuery() throws Exception { IType testType = this.createTestNamedQueryWithQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES); - NamedQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_QUERY, namedQuery.getQuery()); } public void testSetQuery() throws Exception { IType testType = this.createTestNamedQueryWithQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES); - NamedQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_QUERY, namedQuery.getQuery()); namedQuery.setQuery("foo"); @@ -179,20 +179,20 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { public void testHints() throws Exception { IType testType = this.createTestNamedQueries(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES); - NamedQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(0, namedQuery.hintsSize()); } public void testHints2() throws Exception { IType testType = this.createTestNamedQueries(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES); - NamedQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0); namedQuery.addHint(1); @@ -203,20 +203,20 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { public void testHints3() throws Exception { IType testType = this.createTestNamedQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES); - NamedQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(2, namedQuery.hintsSize()); } public void testAddHint() throws Exception { IType testType = this.createTestNamedQueries(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES); - NamedQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("FOO"); namedQuery.addHint(1); @@ -231,10 +231,10 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { public void testRemoveHint() throws Exception { IType testType = this.createTestNamedQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES); - NamedQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -260,10 +260,10 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { public void testMoveHint() throws Exception { IType testType = this.createTestNamedQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES); - NamedQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -282,10 +282,10 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { public void testMoveHint2() throws Exception { IType testType = this.createTestNamedQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); NamedQueries namedQueries = (NamedQueries) typeResource.annotation(JPA.NAMED_QUERIES); - NamedQuery namedQuery = namedQueries.nestedAnnotations().next(); + NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -304,9 +304,9 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { public void testAddNamedQueryCopyExisting() throws Exception { IType jdtType = createTestNamedQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - NamedQuery namedQuery = (NamedQuery) typeResource.addAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); namedQuery.setName("BAR"); assertSourceContains("@NamedQueries({@NamedQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\")),@NamedQuery(name=\"BAR\")})"); @@ -317,21 +317,21 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { public void testAddNamedQueryToBeginningOfList() throws Exception { IType jdtType = createTestNamedQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - NamedQuery namedQuery = (NamedQuery) typeResource.addAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); namedQuery.setName("BAR"); assertSourceContains("@NamedQueries({@NamedQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\")),@NamedQuery(name=\"BAR\")})"); - namedQuery = (NamedQuery) typeResource.addAnnotation(0, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + namedQuery = (NamedQueryAnnotation) typeResource.addAnnotation(0, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); namedQuery.setName("BAZ"); assertSourceContains("@NamedQueries({@NamedQuery(name=\"BAZ\"),@NamedQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\")), @NamedQuery(name=\"BAR\")})"); - Iterator<JavaResource> namedQueries = typeResource.annotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES); - assertEquals("BAZ", ((NamedQuery) namedQueries.next()).getName()); - assertEquals("foo", ((NamedQuery) namedQueries.next()).getName()); - assertEquals("BAR", ((NamedQuery) namedQueries.next()).getName()); + Iterator<JavaResourceNode> namedQueries = typeResource.annotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + assertEquals("BAZ", ((NamedQueryAnnotation) namedQueries.next()).getName()); + assertEquals("foo", ((NamedQueryAnnotation) namedQueries.next()).getName()); + assertEquals("BAR", ((NamedQueryAnnotation) namedQueries.next()).getName()); assertNull(typeResource.annotation(JPA.NAMED_QUERY)); assertNotNull(typeResource.annotation(JPA.NAMED_QUERIES)); @@ -340,9 +340,9 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { public void testRemoveNamedQueryCopyExisting() throws Exception { IType jdtType = createTestNamedQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - NamedQuery namedQuery = (NamedQuery) typeResource.addAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); namedQuery.setName("BAR"); assertSourceContains("@NamedQueries({@NamedQuery(name=\"foo\", query = \"bar\", hints = @QueryHint(name=\"BAR\", value = \"FOO\")),@NamedQuery(name=\"BAR\")})"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java index 00ed0d80e0..f0bf73302e 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/NamedQueryTests.java @@ -13,10 +13,10 @@ import java.util.Iterator; import java.util.ListIterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.NamedQuery; -import org.eclipse.jpt.core.internal.resource.java.QueryHint; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation; +import org.eclipse.jpt.core.resource.java.QueryHintAnnotation; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class NamedQueryTests extends JavaResourceModelTestCase { @@ -92,25 +92,25 @@ public class NamedQueryTests extends JavaResourceModelTestCase { public void testNamedQuery() throws Exception { IType testType = this.createTestNamedQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); assertNotNull(namedQuery); } public void testGetName() throws Exception { IType testType = this.createTestNamedQueryWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); assertEquals(QUERY_NAME, namedQuery.getName()); } public void testSetName() throws Exception { IType testType = this.createTestNamedQueryWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); assertEquals(QUERY_NAME, namedQuery.getName()); namedQuery.setName("foo"); @@ -126,17 +126,17 @@ public class NamedQueryTests extends JavaResourceModelTestCase { public void testGetQuery() throws Exception { IType testType = this.createTestNamedQueryWithQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); assertEquals(QUERY_QUERY, namedQuery.getQuery()); } public void testSetQuery() throws Exception { IType testType = this.createTestNamedQueryWithQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); assertEquals(QUERY_QUERY, namedQuery.getQuery()); namedQuery.setQuery("foo"); @@ -152,18 +152,18 @@ public class NamedQueryTests extends JavaResourceModelTestCase { public void testHints() throws Exception { IType testType = this.createTestNamedQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); assertEquals(0, namedQuery.hintsSize()); } public void testHints2() throws Exception { IType testType = this.createTestNamedQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); namedQuery.addHint(0); namedQuery.addHint(1); @@ -174,26 +174,26 @@ public class NamedQueryTests extends JavaResourceModelTestCase { public void testHints3() throws Exception { IType testType = this.createTestNamedQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); assertEquals(2, namedQuery.hintsSize()); - ListIterator<QueryHint> iterator = namedQuery.hints(); + ListIterator<QueryHintAnnotation> iterator = namedQuery.hints(); assertEquals("BAR", iterator.next().getName()); assertNull(iterator.next().getName()); } public void testAddHint() throws Exception { IType testType = this.createTestNamedQuery(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); namedQuery.addHint(0).setName("FOO"); namedQuery.addHint(1); - QueryHint queryHint = namedQuery.addHint(0); + QueryHintAnnotation queryHint = namedQuery.addHint(0); queryHint.setName("BAR"); assertEquals("BAR", namedQuery.hintAt(0).getName()); @@ -204,9 +204,9 @@ public class NamedQueryTests extends JavaResourceModelTestCase { public void testRemoveHint() throws Exception { IType testType = this.createTestNamedQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -232,9 +232,9 @@ public class NamedQueryTests extends JavaResourceModelTestCase { public void testMoveHint() throws Exception { IType testType = this.createTestNamedQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -253,9 +253,9 @@ public class NamedQueryTests extends JavaResourceModelTestCase { public void testMoveHint2() throws Exception { IType testType = this.createTestNamedQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java index 59f53e5de8..da37699569 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToManyTests.java @@ -12,11 +12,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.FetchType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.OneToMany; +import org.eclipse.jpt.core.resource.java.FetchType; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.OneToMany; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class OneToManyTests extends JavaResourceModelTestCase { @@ -130,8 +130,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testOneToMany() throws Exception { IType testType = this.createTestOneToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertNotNull(oneToMany); @@ -139,8 +139,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testGetFetch() throws Exception { IType testType = this.createTestOneToManyWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertEquals(FetchType.EAGER, oneToMany.getFetch()); @@ -148,8 +148,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testSetFetch() throws Exception { IType testType = this.createTestOneToManyWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertEquals(FetchType.EAGER, oneToMany.getFetch()); @@ -162,8 +162,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testSetFetchNull() throws Exception { IType testType = this.createTestOneToManyWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertEquals(FetchType.EAGER, oneToMany.getFetch()); @@ -178,8 +178,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testGetTargetEntity() throws Exception { IType testType = this.createTestOneToManyWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertEquals(TYPE_NAME, oneToMany.getTargetEntity()); @@ -187,8 +187,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testSetTargetEntity() throws Exception { IType testType = this.createTestOneToManyWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertEquals(TYPE_NAME, oneToMany.getTargetEntity()); @@ -200,8 +200,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testSetTargetEntityNull() throws Exception { IType testType = this.createTestOneToManyWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertEquals(TYPE_NAME, oneToMany.getTargetEntity()); @@ -215,8 +215,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testGetFullyQualifiedTargetEntity() throws Exception { IType testType = this.createTestOneToManyWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertEquals(FULLY_QUALIFIED_TYPE_NAME, oneToMany.getFullyQualifiedTargetEntity()); @@ -233,8 +233,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testGetMappedBy() throws Exception { IType testType = this.createTestOneToManyWithMappedBy(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertEquals("foo", oneToMany.getMappedBy()); @@ -243,8 +243,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testGetMappedByNull() throws Exception { IType testType = this.createTestOneToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertEquals(null, oneToMany.getMappedBy()); @@ -252,8 +252,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testSetMappedBy() throws Exception { IType testType = this.createTestOneToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertNull(oneToMany.getMappedBy()); @@ -265,8 +265,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testSetMappedByNull() throws Exception { IType testType = this.createTestOneToManyWithMappedBy(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertEquals("foo", oneToMany.getMappedBy()); @@ -280,8 +280,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testSetCascadeAll() throws Exception { IType testType = this.createTestOneToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadeAll()); @@ -295,8 +295,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testSetCascadeMerge() throws Exception { IType testType = this.createTestOneToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadeMerge()); @@ -310,8 +310,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testSetCascadePersist() throws Exception { IType testType = this.createTestOneToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadePersist()); @@ -325,8 +325,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testSetCascadeRemove() throws Exception { IType testType = this.createTestOneToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadeRemove()); @@ -340,8 +340,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testSetCascadeRefresh() throws Exception { IType testType = this.createTestOneToMany(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadeRefresh()); @@ -355,8 +355,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testCascadeMoreThanOnce() throws Exception { IType testType = this.createTestOneToManyWithCascade(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertTrue(oneToMany.isCascadeAll()); @@ -380,8 +380,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testDuplicateCascade() throws Exception { IType testType = this.createTestOneToManyWithDuplicateCascade(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertTrue(oneToMany.isCascadeMerge()); @@ -398,8 +398,8 @@ public class OneToManyTests extends JavaResourceModelTestCase { public void testMultipleCascade() throws Exception { IType testType = this.createTestOneToManyWithMultipleCascade(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToMany oneToMany = (OneToMany) attributeResource.mappingAnnotation(JPA.ONE_TO_MANY); assertTrue(oneToMany.isCascadeMerge()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java index 5f71bf21fb..22b4d40d54 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OneToOneTests.java @@ -12,11 +12,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.FetchType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.OneToOne; +import org.eclipse.jpt.core.resource.java.FetchType; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.OneToOne; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class OneToOneTests extends JavaResourceModelTestCase { @@ -144,8 +144,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testOneToOne() throws Exception { IType testType = this.createTestOneToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertNotNull(oneToOne); @@ -153,8 +153,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testGetFetch() throws Exception { IType testType = this.createTestOneToOneWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertEquals(FetchType.EAGER, oneToOne.getFetch()); @@ -162,8 +162,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetFetch() throws Exception { IType testType = this.createTestOneToOneWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertEquals(FetchType.EAGER, oneToOne.getFetch()); @@ -176,8 +176,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetFetchNull() throws Exception { IType testType = this.createTestOneToOneWithFetch(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertEquals(FetchType.EAGER, oneToOne.getFetch()); @@ -192,8 +192,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testGetTargetEntity() throws Exception { IType testType = this.createTestOneToOneWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertEquals(TYPE_NAME, oneToOne.getTargetEntity()); @@ -201,8 +201,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetTargetEntity() throws Exception { IType testType = this.createTestOneToOneWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertEquals(TYPE_NAME, oneToOne.getTargetEntity()); @@ -214,8 +214,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetTargetEntityNull() throws Exception { IType testType = this.createTestOneToOneWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertEquals(TYPE_NAME, oneToOne.getTargetEntity()); @@ -229,8 +229,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testGetFullyQualifiedTargetEntity() throws Exception { IType testType = this.createTestOneToOneWithTargetEntity(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertEquals(FULLY_QUALIFIED_TYPE_NAME, oneToOne.getFullyQualifiedTargetEntity()); @@ -247,8 +247,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testGetOptional() throws Exception { IType testType = this.createTestOneToOneWithOptional(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertTrue(oneToOne.getOptional()); @@ -256,8 +256,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetOptional() throws Exception { IType testType = this.createTestOneToOneWithOptional(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertTrue(oneToOne.getOptional()); @@ -270,8 +270,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetOptionalNull() throws Exception { IType testType = this.createTestOneToOneWithOptional(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertTrue(oneToOne.getOptional()); @@ -285,8 +285,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testGetMappedBy() throws Exception { IType testType = this.createTestOneToOneWithMappedBy(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertEquals("foo", oneToOne.getMappedBy()); @@ -294,8 +294,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testGetMappedByNull() throws Exception { IType testType = this.createTestOneToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertEquals(null, oneToOne.getMappedBy()); @@ -303,8 +303,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetMappedBy() throws Exception { IType testType = this.createTestOneToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertNull(oneToOne.getMappedBy()); @@ -316,8 +316,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetMappedByNull() throws Exception { IType testType = this.createTestOneToOneWithMappedBy(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertEquals("foo", oneToOne.getMappedBy()); @@ -331,8 +331,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetCascadeAll() throws Exception { IType testType = this.createTestOneToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadeAll()); @@ -346,8 +346,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetCascadeMerge() throws Exception { IType testType = this.createTestOneToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadeMerge()); @@ -361,8 +361,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetCascadePersist() throws Exception { IType testType = this.createTestOneToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadePersist()); @@ -376,8 +376,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetCascadeRemove() throws Exception { IType testType = this.createTestOneToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadeRemove()); @@ -391,8 +391,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testSetCascadeRefresh() throws Exception { IType testType = this.createTestOneToOne(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadeRefresh()); @@ -406,8 +406,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testCascadeMoreThanOnce() throws Exception { IType testType = this.createTestOneToOneWithCascade(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertTrue(oneToOne.isCascadeAll()); @@ -431,8 +431,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testDuplicateCascade() throws Exception { IType testType = this.createTestOneToOneWithDuplicateCascade(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertTrue(oneToOne.isCascadeMerge()); @@ -449,8 +449,8 @@ public class OneToOneTests extends JavaResourceModelTestCase { public void testMultipleCascade() throws Exception { IType testType = this.createTestOneToOneWithMultipleCascade(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OneToOne oneToOne = (OneToOne) attributeResource.mappingAnnotation(JPA.ONE_TO_ONE); assertTrue(oneToOne.isCascadeMerge()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java index bf9bd4f81a..fa234f2651 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/OrderByTests.java @@ -11,10 +11,10 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.OrderBy; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.OrderBy; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class OrderByTests extends JavaResourceModelTestCase { @@ -53,8 +53,8 @@ public class OrderByTests extends JavaResourceModelTestCase { public void testOrderBy() throws Exception { IType testType = this.createTestOrderBy(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OrderBy orderBy = (OrderBy) attributeResource.annotation(JPA.ORDER_BY); assertNotNull(orderBy); @@ -62,8 +62,8 @@ public class OrderByTests extends JavaResourceModelTestCase { public void testGetValue() throws Exception { IType testType = this.createTestOrderByWithValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OrderBy orderBy = (OrderBy) attributeResource.annotation(JPA.ORDER_BY); assertEquals("key", orderBy.getValue()); @@ -71,8 +71,8 @@ public class OrderByTests extends JavaResourceModelTestCase { public void testSetValue() throws Exception { IType testType = this.createTestOrderBy(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); OrderBy orderBy = (OrderBy) attributeResource.annotation(JPA.ORDER_BY); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java index db27db9e05..8a39a838c0 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java @@ -11,10 +11,10 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { @@ -92,18 +92,18 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumnWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } public void testGetNull() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertNull(column.getReferencedColumnName()); assertNull(column.getColumnDefinition()); @@ -111,9 +111,9 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertNull(column.getName()); @@ -126,9 +126,9 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumnWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals(COLUMN_NAME, column.getName()); @@ -142,17 +142,17 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { public void testGetReferencedColumnName() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumnWithReferencedColumnName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName()); } public void testSetReferencedColumnName() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertNull(column.getReferencedColumnName()); @@ -169,17 +169,17 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { public void testGetColumnDefinition() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumnWithColumnDefinition(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } public void testSetColumnDefinition() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertNull(column.getColumnDefinition()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java index ce04ec1bad..e5e1ea21c8 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -114,18 +114,18 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumnWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } public void testGetNull() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getName()); assertNull(column.getReferencedColumnName()); @@ -134,9 +134,9 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getName()); @@ -149,9 +149,9 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumnWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertEquals(COLUMN_NAME, column.getName()); @@ -163,17 +163,17 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { public void testGetReferencedColumnName() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumnWithReferencedColumnName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName()); } public void testSetReferencedColumnName() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getReferencedColumnName()); @@ -190,17 +190,17 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { public void testGetColumnDefinition() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumnWithColumnDefinition(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } public void testSetColumnDefinition() throws Exception { IType testType = this.createTestPrimaryKeyJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn column = (PrimaryKeyJoinColumn) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -218,10 +218,10 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { public void testAddPrimaryKeyJoinColumnCopyExisting() throws Exception { IType jdtType = createTestPrimaryKeyJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn joinColumn = (PrimaryKeyJoinColumn) attributeResource.addAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); joinColumn.setName("FOO"); assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"),@PrimaryKeyJoinColumn(name=\"FOO\")})"); @@ -231,21 +231,21 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { } public void testAddPrimaryKeyJoinColumnToBeginningOfList() throws Exception { IType jdtType = createTestPrimaryKeyJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn joinColumn = (PrimaryKeyJoinColumn) attributeResource.addAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); joinColumn.setName("FOO"); assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"),@PrimaryKeyJoinColumn(name=\"FOO\")})"); - joinColumn = (PrimaryKeyJoinColumn) attributeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); joinColumn.setName("BAZ"); assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name=\"BAZ\"),@PrimaryKeyJoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"), @PrimaryKeyJoinColumn(name=\"FOO\")})"); - Iterator<JavaResource> pkJoinColumns = attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); - assertEquals("BAZ", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName()); - assertEquals("BAR", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName()); - assertEquals("FOO", ((PrimaryKeyJoinColumn) pkJoinColumns.next()).getName()); + Iterator<JavaResourceNode> pkJoinColumns = attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); + assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); + assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName()); assertNull(attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMN)); assertNotNull(attributeResource.annotation(JPA.PRIMARY_KEY_JOIN_COLUMNS)); @@ -254,10 +254,10 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { public void testRemovePrimaryKeyJoinColumnCopyExisting() throws Exception { IType jdtType = createTestPrimaryKeyJoinColumn(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumn joinColumn = (PrimaryKeyJoinColumn) attributeResource.addAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); joinColumn.setName("FOO"); assertSourceContains("@PrimaryKeyJoinColumns({@PrimaryKeyJoinColumn(name=\"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\"),@PrimaryKeyJoinColumn(name=\"FOO\")})"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java index 491a202468..f245f4dd2f 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/QueryHintTests.java @@ -11,10 +11,10 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.NamedQuery; -import org.eclipse.jpt.core.internal.resource.java.QueryHint; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.NamedQueryAnnotation; +import org.eclipse.jpt.core.resource.java.QueryHintAnnotation; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class QueryHintTests extends JavaResourceModelTestCase { @@ -54,19 +54,19 @@ public class QueryHintTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestNamedQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); - QueryHint queryHint = namedQuery.hints().next(); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); + QueryHintAnnotation queryHint = namedQuery.hints().next(); assertEquals(QUERY_HINT_NAME, queryHint.getName()); } public void testSetName() throws Exception { IType testType = this.createTestNamedQueryWithQueryHints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - NamedQuery namedQuery = (NamedQuery) typeResource.annotation(JPA.NAMED_QUERY); - QueryHint queryHint = namedQuery.hints().next(); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.annotation(JPA.NAMED_QUERY); + QueryHintAnnotation queryHint = namedQuery.hints().next(); assertEquals(QUERY_HINT_NAME, queryHint.getName()); queryHint.setName("foo"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java index 7ca5b65d71..f77b7b62ba 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTableTests.java @@ -12,11 +12,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.resource.java.SecondaryTable; -import org.eclipse.jpt.core.internal.resource.java.UniqueConstraint; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation; +import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation; +import org.eclipse.jpt.core.resource.java.UniqueConstraint; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class SecondaryTableTests extends JavaResourceModelTestCase { @@ -133,18 +133,18 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestSecondaryTableWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertEquals(TABLE_NAME, table.getName()); } public void testGetNull() throws Exception { IType testType = this.createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertNull(table.getName()); assertNull(table.getCatalog()); @@ -153,9 +153,9 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertNull(table.getName()); @@ -167,9 +167,9 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestSecondaryTableWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals(TABLE_NAME, table.getName()); table.setName(null); @@ -180,18 +180,18 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testGetCatalog() throws Exception { IType testType = this.createTestSecondaryTableWithCatalog(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertEquals(CATALOG_NAME, table.getCatalog()); } public void testSetCatalog() throws Exception { IType testType = this.createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertNull(table.getCatalog()); @@ -203,9 +203,9 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testSetCatalogNull() throws Exception { IType testType = this.createTestSecondaryTableWithCatalog(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals(CATALOG_NAME, table.getCatalog()); table.setCatalog(null); @@ -216,18 +216,18 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testGetSchema() throws Exception { IType testType = this.createTestSecondaryTableWithSchema(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertEquals(SCHEMA_NAME, table.getSchema()); } public void testSetSchema() throws Exception { IType testType = this.createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertNull(table.getSchema()); @@ -239,9 +239,9 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testSetSchemaNull() throws Exception { IType testType = this.createTestSecondaryTableWithSchema(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals(SCHEMA_NAME, table.getSchema()); table.setSchema(null); @@ -253,16 +253,16 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testUniqueConstraints() throws Exception { IType testType = this.createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals(0, table.uniqueConstraintsSize()); } public void testUniqueConstraints2() throws Exception { IType testType = this.createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); table.addUniqueConstraint(0); table.addUniqueConstraint(1); @@ -273,16 +273,16 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testUniqueConstraints3() throws Exception { IType testType = this.createTestSecondaryTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals(3, table.uniqueConstraintsSize()); } public void testAddUniqueConstraint() throws Exception { IType testType = this.createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1); @@ -297,8 +297,8 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint() throws Exception { IType testType = this.createTestSecondaryTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); table.removeUniqueConstraint(1); Iterator<UniqueConstraint> uniqueConstraints = table.uniqueConstraints(); @@ -321,8 +321,8 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint() throws Exception { IType testType = this.createTestSecondaryTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable secondaryTable = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next()); assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next()); @@ -339,8 +339,8 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint2() throws Exception { IType testType = this.createTestSecondaryTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable secondaryTable = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next()); assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next()); @@ -358,16 +358,16 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testPkJoinColumns() throws Exception { IType testType = this.createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals(0, table.pkJoinColumnsSize()); } public void testPkJoinColumns2() throws Exception { IType testType = this.createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); table.addPkJoinColumn(0); table.addPkJoinColumn(1); @@ -378,16 +378,16 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testPkJoinColumns3() throws Exception { IType testType = this.createTestSecondaryTableWithPkJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals(3, table.pkJoinColumnsSize()); } public void testAddPkJoinColumn() throws Exception { IType testType = this.createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); table.addPkJoinColumn(0).setName("FOO"); @@ -404,8 +404,8 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testRemovePkJoinColumn() throws Exception { IType testType = this.createTestSecondaryTableWithPkJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); table.removePkJoinColumn(1); assertSourceContains("@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"BAR\"), @PrimaryKeyJoinColumn(name=\"BAZ\")})"); @@ -420,9 +420,9 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testMovePkJoinColumn() throws Exception { IType testType = this.createTestSecondaryTableWithPkJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); - PrimaryKeyJoinColumn joinColumn = table.pkJoinColumnAt(0); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); + PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setColumnDefinition("COLUMN_DEF"); table.movePkJoinColumn(2, 0); @@ -431,11 +431,11 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testMovePkJoinColumn2() throws Exception { IType testType = this.createTestSecondaryTableWithPkJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); - PrimaryKeyJoinColumn joinColumn = table.pkJoinColumnAt(0); + PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setColumnDefinition("COLUMN_DEF"); table.movePkJoinColumn(0, 2); @@ -444,12 +444,12 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testSetPkJoinColumnName() throws Exception { IType testType = this.createTestSecondaryTableWithPkJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertEquals(3, table.pkJoinColumnsSize()); - PrimaryKeyJoinColumn joinColumn = table.pkJoinColumns().next(); + PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumns().next(); assertEquals("BAR", joinColumn.getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java index edeeaa2447..4c6d917efb 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SecondaryTablesTests.java @@ -12,12 +12,12 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.PrimaryKeyJoinColumn; -import org.eclipse.jpt.core.internal.resource.java.SecondaryTable; -import org.eclipse.jpt.core.internal.resource.java.SecondaryTables; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.PrimaryKeyJoinColumnAnnotation; +import org.eclipse.jpt.core.resource.java.SecondaryTableAnnotation; +import org.eclipse.jpt.core.resource.java.SecondaryTables; import org.eclipse.jpt.utility.internal.CollectionTools; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; @@ -157,23 +157,23 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestSecondaryTableWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotation(JPA.SECONDARY_TABLE); assertNull(table); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); assertNotNull(secondaryTables); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); assertEquals(TABLE_NAME, secondaryTable.getName()); } public void testGetNull() throws Exception { IType testType = this.createTestSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); assertNull(secondaryTable.getName()); assertNull(secondaryTable.getCatalog()); assertNull(secondaryTable.getSchema()); @@ -181,10 +181,10 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); assertNull(secondaryTable.getName()); @@ -196,10 +196,10 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestSecondaryTableWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); assertEquals(TABLE_NAME, secondaryTable.getName()); secondaryTable.setName(null); @@ -210,19 +210,19 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testGetCatalog() throws Exception { IType testType = this.createTestSecondaryTableWithCatalog(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); assertEquals(CATALOG_NAME, secondaryTable.getCatalog()); } public void testSetCatalog() throws Exception { IType testType = this.createTestSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); assertNull(secondaryTable.getCatalog()); secondaryTable.setCatalog("Foo"); @@ -233,10 +233,10 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testSetCatalogNull() throws Exception { IType testType = this.createTestSecondaryTableWithCatalog(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); assertEquals(CATALOG_NAME, secondaryTable.getCatalog()); secondaryTable.setCatalog(null); @@ -247,20 +247,20 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testGetSchema() throws Exception { IType testType = this.createTestSecondaryTableWithSchema(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); assertNotNull(secondaryTable); assertEquals(SCHEMA_NAME, secondaryTable.getSchema()); } public void testSetSchema() throws Exception { IType testType = this.createTestSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); assertNull(secondaryTable.getSchema()); secondaryTable.setSchema("Foo"); @@ -271,10 +271,10 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testSetSchemaNull() throws Exception { IType testType = this.createTestSecondaryTableWithSchema(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); assertEquals(SCHEMA_NAME, secondaryTable.getSchema()); secondaryTable.setSchema(null); @@ -286,18 +286,18 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testUniqueConstraints() throws Exception { IType testType = this.createTestSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); assertEquals(0, secondaryTable.uniqueConstraintsSize()); } public void testUniqueConstraints2() throws Exception { IType testType = this.createTestSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); secondaryTable.addUniqueConstraint(0); secondaryTable.addUniqueConstraint(1); @@ -308,18 +308,18 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testUniqueConstraints3() throws Exception { IType testType = this.createTestSecondaryTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); assertEquals(2, secondaryTable.uniqueConstraintsSize()); } public void testAddUniqueConstraint() throws Exception { IType testType = this.createTestSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); secondaryTable.addUniqueConstraint(0).addColumnName("FOO"); secondaryTable.addUniqueConstraint(1); @@ -334,9 +334,9 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint() throws Exception { IType testType = this.createTestSecondaryTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); secondaryTable.addUniqueConstraint(0).addColumnName("FOO"); secondaryTable.removeUniqueConstraint(2); @@ -351,9 +351,9 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint() throws Exception { IType testType = this.createTestSecondaryTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); secondaryTable.addUniqueConstraint(0).addColumnName("FOO"); assertEquals("FOO", secondaryTable.uniqueConstraintAt(0).columnNames().next()); @@ -369,9 +369,9 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint2() throws Exception { IType testType = this.createTestSecondaryTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); SecondaryTables secondaryTables = (SecondaryTables) typeResource.annotation(JPA.SECONDARY_TABLES); - SecondaryTable secondaryTable = secondaryTables.nestedAnnotationAt(0); + SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotationAt(0); secondaryTable.addUniqueConstraint(0).addColumnName("FOO"); assertEquals("FOO", secondaryTable.uniqueConstraintAt(0).columnNames().next()); @@ -390,9 +390,9 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { // @SecondaryTable(name="FOO") @SecondaryTables({@SecondaryTable(name="FOO"), @SecondaryTable(name="BAR")}) public void testAddSecondaryTableCopyExisting() throws Exception { IType jdtType = createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - SecondaryTable secondaryTable = (SecondaryTable) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\", catalog = \"BAR\", schema = \"BAZ\", uniqueConstraints = @UniqueConstraint(columnNames=\"BAR\")),@SecondaryTable(name=\"BAR\")})"); @@ -403,20 +403,20 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testAddSecondaryTable() throws Exception { IType jdtType = createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - SecondaryTable secondaryTable = (SecondaryTable) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\", catalog = \"BAR\", schema = \"BAZ\", uniqueConstraints = @UniqueConstraint(columnNames=\"BAR\")),@SecondaryTable(name=\"BAR\")})"); - secondaryTable = (SecondaryTable) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + secondaryTable = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable.setName("BAZ"); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"BAZ\"),@SecondaryTable(name=\"FOO\", catalog = \"BAR\", schema = \"BAZ\", uniqueConstraints = @UniqueConstraint(columnNames=\"BAR\")), @SecondaryTable(name=\"BAR\")})"); - Iterator<JavaResource> secondaryTables = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); - assertEquals("BAZ", ((SecondaryTable) secondaryTables.next()).getName()); - assertEquals("FOO", ((SecondaryTable) secondaryTables.next()).getName()); - assertEquals("BAR", ((SecondaryTable) secondaryTables.next()).getName()); + Iterator<JavaResourceNode> secondaryTables = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); + assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); + assertEquals("BAR", ((SecondaryTableAnnotation) secondaryTables.next()).getName()); assertNull(typeResource.annotation(JPA.SECONDARY_TABLE)); assertNotNull(typeResource.annotation(JPA.SECONDARY_TABLES)); @@ -425,9 +425,9 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testRemoveSecondaryTableCopyExisting() throws Exception { IType jdtType = createTestSecondaryTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(jdtType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(jdtType); - SecondaryTable secondaryTable = (SecondaryTable) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTable.setName("BAR"); assertSourceContains("@SecondaryTables({@SecondaryTable(name=\"FOO\", catalog = \"BAR\", schema = \"BAZ\", uniqueConstraints = @UniqueConstraint(columnNames=\"BAR\")),@SecondaryTable(name=\"BAR\")})"); @@ -438,16 +438,16 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testPkJoinColumns() throws Exception { IType testType = this.createTestSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals(0, table.pkJoinColumnsSize()); } public void testPkJoinColumns2() throws Exception { IType testType = this.createTestSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); table.addPkJoinColumn(0); table.addPkJoinColumn(1); @@ -458,16 +458,16 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testPkJoinColumns3() throws Exception { IType testType = this.createTestSecondaryTablesWithPkJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals(3, table.pkJoinColumnsSize()); } public void testAddPkJoinColumn() throws Exception { IType testType = this.createTestSecondaryTables(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); table.addPkJoinColumn(0).setName("FOO"); table.addPkJoinColumn(1); @@ -478,8 +478,8 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testRemovePkJoinColumn() throws Exception { IType testType = this.createTestSecondaryTablesWithPkJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); table.removePkJoinColumn(1); assertSourceContains("@SecondaryTables(@SecondaryTable(pkJoinColumns={@PrimaryKeyJoinColumn(name=\"BAR\"), @PrimaryKeyJoinColumn(name=\"BAZ\")}))"); @@ -493,9 +493,9 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testMovePkJoinColumn() throws Exception { IType testType = this.createTestSecondaryTablesWithPkJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); - PrimaryKeyJoinColumn joinColumn = table.pkJoinColumnAt(0); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setColumnDefinition("COLUMN_DEF"); table.movePkJoinColumn(2, 0); @@ -504,11 +504,11 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testMovePkJoinColumn2() throws Exception { IType testType = this.createTestSecondaryTablesWithPkJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); - PrimaryKeyJoinColumn joinColumn = table.pkJoinColumnAt(0); + PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setColumnDefinition("COLUMN_DEF"); table.movePkJoinColumn(0, 2); @@ -517,12 +517,12 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testSetPkJoinColumnName() throws Exception { IType testType = this.createTestSecondaryTablesWithPkJoinColumns(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - SecondaryTable table = (SecondaryTable) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals(3, table.pkJoinColumnsSize()); - PrimaryKeyJoinColumn joinColumn = table.pkJoinColumns().next(); + PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumns().next(); assertEquals("BAR", joinColumn.getName()); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java index 1f48b1e14c..637c96dd9a 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/SequenceGeneratorTests.java @@ -11,10 +11,10 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.SequenceGenerator; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.SequenceGeneratorAnnotation; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class SequenceGeneratorTests extends JavaResourceModelTestCase { @@ -109,36 +109,36 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { public void testSequenceGeneratorOnField() throws Exception { IType testType = this.createTestSequenceGeneratorOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertNotNull(sequenceGenerator); } public void testSequenceGeneratorOnType() throws Exception { IType testType = this.createTestSequenceGeneratorOnType(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - SequenceGenerator sequenceGenerator = (SequenceGenerator) typeResource.annotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) typeResource.annotation(JPA.SEQUENCE_GENERATOR); assertNotNull(sequenceGenerator); } public void testGetName() throws Exception { IType testType = this.createTestSequenceGeneratorWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_NAME, sequenceGenerator.getName()); } public void testSetName() throws Exception { IType testType = this.createTestSequenceGeneratorWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_NAME, sequenceGenerator.getName()); sequenceGenerator.setName("foo"); @@ -154,19 +154,19 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { public void testGetSequenceName() throws Exception { IType testType = this.createTestSequenceGeneratorWithSequenceName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_SEQUENCE_NAME, sequenceGenerator.getSequenceName()); } public void testSetSequenceName() throws Exception { IType testType = this.createTestSequenceGeneratorWithSequenceName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_SEQUENCE_NAME, sequenceGenerator.getSequenceName()); sequenceGenerator.setSequenceName("foo"); @@ -182,19 +182,19 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { public void testGetAllocationSize() throws Exception { IType testType = this.createTestSequenceGeneratorWithAllocationSize(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_ALLOCATION_SIZE, sequenceGenerator.getAllocationSize()); } public void testSetAllocationSize() throws Exception { IType testType = this.createTestSequenceGeneratorWithAllocationSize(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_ALLOCATION_SIZE, sequenceGenerator.getAllocationSize()); sequenceGenerator.setAllocationSize(Integer.valueOf(500)); @@ -212,19 +212,19 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { public void testGetInitialValue() throws Exception { IType testType = this.createTestSequenceGeneratorWithInitialValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_INITIAL_VALUE, sequenceGenerator.getInitialValue()); } public void testSetInitialValue() throws Exception { IType testType = this.createTestSequenceGeneratorWithInitialValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGenerator sequenceGenerator = (SequenceGenerator) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.annotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_INITIAL_VALUE, sequenceGenerator.getInitialValue()); sequenceGenerator.setInitialValue(Integer.valueOf(500)); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java index a5c40aa496..551561b765 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableGeneratorTests.java @@ -12,10 +12,10 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.TableGenerator; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.TableGeneratorAnnotation; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class TableGeneratorTests extends JavaResourceModelTestCase { @@ -155,36 +155,36 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testTableGeneratorOnField() throws Exception { IType testType = this.createTestTableGeneratorOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertNotNull(tableGenerator); } public void testTableGeneratorOnType() throws Exception { IType testType = this.createTestTableGeneratorOnType(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - TableGenerator tableGenerator = (TableGenerator) typeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) typeResource.annotation(JPA.TABLE_GENERATOR); assertNotNull(tableGenerator); } public void testGetName() throws Exception { IType testType = this.createTestTableGeneratorWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_NAME, tableGenerator.getName()); } public void testSetName() throws Exception { IType testType = this.createTestTableGeneratorWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_NAME, tableGenerator.getName()); tableGenerator.setName("foo"); @@ -200,19 +200,19 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testGetTable() throws Exception { IType testType = this.createTestTableGeneratorWithTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_TABLE, tableGenerator.getTable()); } public void testSetTable() throws Exception { IType testType = this.createTestTableGeneratorWithTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_TABLE, tableGenerator.getTable()); tableGenerator.setTable("foo"); @@ -228,19 +228,19 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testGetCatalog() throws Exception { IType testType = this.createTestTableGeneratorWithCatalog(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_CATALOG, tableGenerator.getCatalog()); } public void testSetCatalog() throws Exception { IType testType = this.createTestTableGeneratorWithCatalog(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_CATALOG, tableGenerator.getCatalog()); tableGenerator.setCatalog("foo"); @@ -256,19 +256,19 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testGetSchema() throws Exception { IType testType = this.createTestTableGeneratorWithSchema(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_SCHEMA, tableGenerator.getSchema()); } public void testSetSchema() throws Exception { IType testType = this.createTestTableGeneratorWithSchema(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_SCHEMA, tableGenerator.getSchema()); tableGenerator.setSchema("foo"); @@ -284,19 +284,19 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testGetPkColumnName() throws Exception { IType testType = this.createTestTableGeneratorWithPkColumnName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_PK_COLUMN_NAME, tableGenerator.getPkColumnName()); } public void testSetPkColumnName() throws Exception { IType testType = this.createTestTableGeneratorWithPkColumnName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_PK_COLUMN_NAME, tableGenerator.getPkColumnName()); tableGenerator.setPkColumnName("foo"); @@ -312,19 +312,19 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testGetValueColumnName() throws Exception { IType testType = this.createTestTableGeneratorWithValueColumnName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_VALUE_COLUMN_NAME, tableGenerator.getValueColumnName()); } public void testSetValueColumnName() throws Exception { IType testType = this.createTestTableGeneratorWithValueColumnName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_VALUE_COLUMN_NAME, tableGenerator.getValueColumnName()); tableGenerator.setValueColumnName("foo"); @@ -340,19 +340,19 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testGetPkColumnValue() throws Exception { IType testType = this.createTestTableGeneratorWithPkColumnValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_PK_COLUMN_VALUE, tableGenerator.getPkColumnValue()); } public void testSetPkColumnValue() throws Exception { IType testType = this.createTestTableGeneratorWithPkColumnValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_PK_COLUMN_VALUE, tableGenerator.getPkColumnValue()); tableGenerator.setPkColumnValue("foo"); @@ -368,19 +368,19 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testGetAllocationSize() throws Exception { IType testType = this.createTestTableGeneratorWithAllocationSize(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_ALLOCATION_SIZE, tableGenerator.getAllocationSize()); } public void testSetAllocationSize() throws Exception { IType testType = this.createTestTableGeneratorWithAllocationSize(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_ALLOCATION_SIZE, tableGenerator.getAllocationSize()); tableGenerator.setAllocationSize(Integer.valueOf(500)); @@ -398,19 +398,19 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testGetInitialValue() throws Exception { IType testType = this.createTestTableGeneratorWithInitialValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_INITIAL_VALUE, tableGenerator.getInitialValue()); } public void testSetInitialValue() throws Exception { IType testType = this.createTestTableGeneratorWithInitialValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_INITIAL_VALUE, tableGenerator.getInitialValue()); tableGenerator.setInitialValue(Integer.valueOf(500)); @@ -428,10 +428,10 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testUniqueConstraints() throws Exception { IType testType = this.createTestTableGeneratorOnField(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(0, tableGenerator.uniqueConstraintsSize()); } @@ -439,10 +439,10 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testUniqueConstraints2() throws Exception { IType testType = this.createTestTableGeneratorOnField(); this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.addUniqueConstraint(0); tableGenerator.addUniqueConstraint(1); @@ -453,10 +453,10 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testUniqueConstraints3() throws Exception { IType testType = this.createTestTableGeneratorWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); assertEquals(3, tableGenerator.uniqueConstraintsSize()); } @@ -464,10 +464,10 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testAddUniqueConstraint() throws Exception { IType testType = this.createTestTableGeneratorOnField(); this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.addUniqueConstraint(0).addColumnName("FOO"); tableGenerator.addUniqueConstraint(1); @@ -483,10 +483,10 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint() throws Exception { IType testType = this.createTestTableGeneratorWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.removeUniqueConstraint(1); assertSourceContains("@TableGenerator(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"BAZ\"})})"); @@ -500,10 +500,10 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint() throws Exception { IType testType = this.createTestTableGeneratorWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.moveUniqueConstraint(2, 0); assertSourceContains("@TableGenerator(uniqueConstraints={@UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"}), @UniqueConstraint(columnNames={\"BAR\"})})"); @@ -511,10 +511,10 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint2() throws Exception { IType testType = this.createTestTableGeneratorWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGenerator tableGenerator = (TableGenerator) attributeResource.annotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.annotation(JPA.TABLE_GENERATOR); tableGenerator.moveUniqueConstraint(0, 2); assertSourceContains("@TableGenerator(uniqueConstraints={@UniqueConstraint(columnNames={\"BAZ\"}), @UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"})})"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java index 6110d7ca4d..dffc089d52 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TableTests.java @@ -12,9 +12,9 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; import org.eclipse.jpt.core.internal.jdtutility.JDTTools; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.Table; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.TableAnnotation; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class TableTests extends JavaResourceModelTestCase { @@ -99,18 +99,18 @@ public class TableTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { IType testType = this.createTestTableWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertNotNull(table); assertEquals(TABLE_NAME, table.getName()); } public void testGetNull() throws Exception { IType testType = this.createTestTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertNotNull(table); assertNull(table.getName()); assertNull(table.getCatalog()); @@ -119,9 +119,9 @@ public class TableTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { IType testType = this.createTestTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertNotNull(table); assertNull(table.getName()); @@ -133,9 +133,9 @@ public class TableTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { IType testType = this.createTestTableWithName(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertEquals(TABLE_NAME, table.getName()); table.setName(null); @@ -146,18 +146,18 @@ public class TableTests extends JavaResourceModelTestCase { public void testGetCatalog() throws Exception { IType testType = this.createTestTableWithCatalog(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertNotNull(table); assertEquals(CATALOG_NAME, table.getCatalog()); } public void testSetCatalog() throws Exception { IType testType = this.createTestTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertNotNull(table); assertNull(table.getCatalog()); @@ -169,9 +169,9 @@ public class TableTests extends JavaResourceModelTestCase { public void testSetCatalogNull() throws Exception { IType testType = this.createTestTableWithCatalog(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertEquals(CATALOG_NAME, table.getCatalog()); table.setCatalog(null); @@ -182,18 +182,18 @@ public class TableTests extends JavaResourceModelTestCase { public void testGetSchema() throws Exception { IType testType = this.createTestTableWithSchema(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertNotNull(table); assertEquals(SCHEMA_NAME, table.getSchema()); } public void testSetSchema() throws Exception { IType testType = this.createTestTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertNotNull(table); assertNull(table.getSchema()); @@ -205,9 +205,9 @@ public class TableTests extends JavaResourceModelTestCase { public void testSetSchemaNull() throws Exception { IType testType = this.createTestTableWithSchema(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertEquals(SCHEMA_NAME, table.getSchema()); table.setSchema(null); @@ -218,8 +218,8 @@ public class TableTests extends JavaResourceModelTestCase { public void testUniqueConstraints() throws Exception { IType testType = this.createTestTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertEquals(0, table.uniqueConstraintsSize()); } @@ -227,8 +227,8 @@ public class TableTests extends JavaResourceModelTestCase { public void testUniqueConstraints2() throws Exception { IType testType = this.createTestTable(); this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); table.addUniqueConstraint(0); table.addUniqueConstraint(1); @@ -239,8 +239,8 @@ public class TableTests extends JavaResourceModelTestCase { public void testUniqueConstraints3() throws Exception { IType testType = this.createTestTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); assertEquals(3, table.uniqueConstraintsSize()); } @@ -248,8 +248,8 @@ public class TableTests extends JavaResourceModelTestCase { public void testAddUniqueConstraint() throws Exception { IType testType = this.createTestTable(); this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1); @@ -265,8 +265,8 @@ public class TableTests extends JavaResourceModelTestCase { public void testAddUniqueConstraint2() throws Exception { IType testType = this.createTestTable(); this.createAnnotationAndMembers("UniqueConstraint", "String[] columnNames();"); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(0); @@ -277,8 +277,8 @@ public class TableTests extends JavaResourceModelTestCase { } public void testRemoveUniqueConstraint() throws Exception { IType testType = this.createTestTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); table.removeUniqueConstraint(1); assertSourceContains("@Table(uniqueConstraints={@UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"BAZ\"})})"); @@ -292,8 +292,8 @@ public class TableTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint2() throws Exception { IType testType = this.createTestTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1).addColumnName("BAR"); table.addUniqueConstraint(2).addColumnName("BAZ"); @@ -311,8 +311,8 @@ public class TableTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint3() throws Exception { IType testType = this.createTestTable(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1).addColumnName("BAR"); table.addUniqueConstraint(2).addColumnName("BAZ"); @@ -330,8 +330,8 @@ public class TableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint() throws Exception { IType testType = this.createTestTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); table.moveUniqueConstraint(2, 0); assertSourceContains("@Table(uniqueConstraints={@UniqueConstraint(columnNames={\"FOO\"}), @UniqueConstraint(columnNames={\"BAZ\"}), @UniqueConstraint(columnNames={\"BAR\"})})"); @@ -339,8 +339,8 @@ public class TableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint2() throws Exception { IType testType = this.createTestTableWithUniqueConstraints(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - Table table = (Table) typeResource.annotation(JPA.TABLE); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + TableAnnotation table = (TableAnnotation) typeResource.annotation(JPA.TABLE); table.moveUniqueConstraint(0, 2); assertSourceContains("@Table(uniqueConstraints={@UniqueConstraint(columnNames={\"BAZ\"}), @UniqueConstraint(columnNames={\"BAR\"}), @UniqueConstraint(columnNames={\"FOO\"})})"); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java index 9ea3455421..9f7bfdcddf 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TemporalTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.Temporal; -import org.eclipse.jpt.core.internal.resource.java.TemporalType; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.Temporal; +import org.eclipse.jpt.core.resource.java.TemporalType; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class TemporalTests extends JavaResourceModelTestCase { @@ -56,8 +56,8 @@ public class TemporalTests extends JavaResourceModelTestCase { public void testTemporal() throws Exception { IType testType = this.createTestTemporal(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Temporal temporal = (Temporal) attributeResource.annotation(JPA.TEMPORAL); assertNotNull(temporal); @@ -65,8 +65,8 @@ public class TemporalTests extends JavaResourceModelTestCase { public void testGetValue() throws Exception { IType testType = this.createTestTemporalWithValue(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Temporal temporal = (Temporal) attributeResource.annotation(JPA.TEMPORAL); assertEquals(TemporalType.DATE, temporal.getValue()); @@ -74,8 +74,8 @@ public class TemporalTests extends JavaResourceModelTestCase { public void testSetValue() throws Exception { IType testType = this.createTestTemporal(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); Temporal temporal = (Temporal) attributeResource.annotation(JPA.TEMPORAL); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java index 0e5472cb4d..1c312ac35b 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/TransientTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.Transient; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.Transient; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class TransientTests extends JavaResourceModelTestCase { @@ -40,10 +40,10 @@ public class TransientTests extends JavaResourceModelTestCase { public void testTransient() throws Exception { IType testType = this.createTestTransient(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResource mappingAnnotation = attributeResource.mappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.mappingAnnotation(); assertTrue(mappingAnnotation instanceof Transient); } diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java index c7ec8a9d29..aa65e17045 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/VersionTests.java @@ -11,11 +11,11 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.core.internal.resource.java.JPA; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentAttributeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaPersistentTypeResource; -import org.eclipse.jpt.core.internal.resource.java.JavaResource; -import org.eclipse.jpt.core.internal.resource.java.Version; +import org.eclipse.jpt.core.resource.java.JPA; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute; +import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType; +import org.eclipse.jpt.core.resource.java.JavaResourceNode; +import org.eclipse.jpt.core.resource.java.Version; import org.eclipse.jpt.utility.internal.iterators.ArrayIterator; public class VersionTests extends JavaResourceModelTestCase { @@ -40,10 +40,10 @@ public class VersionTests extends JavaResourceModelTestCase { public void testVersion() throws Exception { IType testType = this.createTestVersion(); - JavaPersistentTypeResource typeResource = buildJavaTypeResource(testType); - JavaPersistentAttributeResource attributeResource = typeResource.fields().next(); + JavaResourcePersistentType typeResource = buildJavaTypeResource(testType); + JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResource mappingAnnotation = attributeResource.mappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.mappingAnnotation(); assertTrue(mappingAnnotation instanceof Version); } } |