diff options
Diffstat (limited to 'jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource')
45 files changed, 697 insertions, 703 deletions
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 d86c38e831..f3463c3301 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 @@ -57,7 +57,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertNotNull(associationOverride); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -67,7 +67,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertNotNull(associationOverride); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -81,7 +81,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -98,7 +98,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(0, associationOverride.joinColumnsSize()); } @@ -108,7 +108,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); associationOverride.addJoinColumn(0); @@ -122,7 +122,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(2, associationOverride.joinColumnsSize()); } @@ -132,7 +132,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); associationOverride.addJoinColumn(0).setName("FOO"); associationOverride.addJoinColumn(1); @@ -150,7 +150,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); associationOverride.addJoinColumn(0).setName("FOO"); Iterator<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns(); @@ -184,7 +184,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); @@ -210,7 +210,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); @@ -237,7 +237,7 @@ public class AssociationOverrideTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE); assertEquals(2, associationOverride.joinColumnsSize()); 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 c7a207c3c5..9f1385dc63 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 @@ -76,7 +76,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next(); assertNotNull(associationOverride); @@ -87,7 +87,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next(); assertNotNull(associationOverride); @@ -102,7 +102,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAssociationOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES); + AssociationOverridesAnnotation associationOverrides = (AssociationOverridesAnnotation) attributeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES); AssociationOverrideAnnotation associationOverride = associationOverrides.nestedAnnotations().next(); assertEquals(ASSOCIATION_OVERRIDE_NAME, associationOverride.getName()); @@ -118,46 +118,46 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestAssociationOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES))); + assertNull(typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE)); + assertNotNull(typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES))); } public void testAddAssociationOverrideToBeginningOfList() throws Exception { ICompilationUnit cu = createTestAssociationOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - Iterator<NestableAnnotation> associationOverrides = typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + Iterator<NestableAnnotation> 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.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.ASSOCIATION_OVERRIDES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES))); + assertNull(typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE)); + assertNotNull(typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES))); } public void testRemoveAssociationOverrideCopyExisting() throws Exception { ICompilationUnit cu = createTestAssociationOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - typeResource.removeSupportingAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); + typeResource.removeAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES); assertSourceContains("@AssociationOverride(name = \"FOO\", joinColumns = @JoinColumn(name = \"FOO\", columnDefinition = \"BAR\", referencedColumnName = \"BAZ\"))", cu); } @@ -166,7 +166,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); assertEquals(0, associationOverride.joinColumnsSize()); } @@ -176,7 +176,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(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); @@ -189,7 +189,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); assertEquals(2, associationOverride.joinColumnsSize()); } @@ -199,7 +199,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(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); @@ -219,7 +219,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(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<JoinColumnAnnotation> joinColumns = associationOverride.joinColumns(); @@ -253,7 +253,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + 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); @@ -278,7 +278,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); JoinColumnAnnotation joinColumn = associationOverride.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); @@ -304,7 +304,7 @@ public class AssociationOverridesTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); + AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) attributeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).next(); assertEquals(2, associationOverride.joinColumnsSize()); 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 2b62b55107..a3a8c701c3 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 @@ -58,7 +58,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); assertNotNull(attributeOverride); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -68,7 +68,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); ColumnAnnotation column = attributeOverride.getColumn(); assertNotNull(attributeOverride); assertNull(column); @@ -78,7 +78,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); assertNotNull(attributeOverride); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -92,7 +92,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -107,7 +107,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); ColumnAnnotation column = attributeOverride.getColumn(); assertEquals(COLUMN_NAME, column.getName()); } @@ -116,7 +116,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); ColumnAnnotation column = attributeOverride.getColumn(); assertEquals(COLUMN_NAME, column.getName()); @@ -133,7 +133,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE); ColumnAnnotation column = attributeOverride.getColumn(); assertNull(column); @@ -147,7 +147,7 @@ public class AttributeOverrideTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.getAnnotation(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 51b5418cc6..6ff234c926 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 @@ -77,7 +77,7 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES); + AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES); AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); assertNotNull(attributeOverride); @@ -88,7 +88,7 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES); + AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES); AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); ColumnAnnotation column = attributeOverride.getColumn(); assertNotNull(attributeOverride); @@ -99,7 +99,7 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES); + AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES); AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); assertNotNull(attributeOverride); @@ -114,7 +114,7 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES); + AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES); AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); assertEquals(ATTRIBUTE_OVERRIDE_NAME, attributeOverride.getName()); @@ -130,7 +130,7 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES); + AttributeOverridesAnnotation attributeOverrides = (AttributeOverridesAnnotation) attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES); AttributeOverrideAnnotation attributeOverride = attributeOverrides.nestedAnnotations().next(); ColumnAnnotation column = attributeOverride.getColumn(); @@ -141,7 +141,7 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestAttributeOverrideWithColumnOnField(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); ColumnAnnotation column = attributeOverride.getColumn(); @@ -160,46 +160,46 @@ public class AttributeOverridesTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestAttributeOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNull(typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } public void testAddAttributeOverrideToBeginningOfList() throws Exception { ICompilationUnit cu = createTestAttributeOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - Iterator<NestableAnnotation> attributeOverrides = typeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + Iterator<NestableAnnotation> 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.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNull(typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } public void testRemoveAttributeOverrideCopyExisting() throws Exception { ICompilationUnit cu = createTestAttributeOverride(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - typeResource.removeSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + typeResource.removeAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertSourceContains("@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))", cu); } //not sure i want to test this api, how can we keep ContainerAnnotation.add, move, remove from being public? 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 f2077b9595..84e8fa4fd5 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 @@ -69,7 +69,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertNotNull(basic); } @@ -78,7 +78,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(Boolean.TRUE, basic.getOptional()); } @@ -87,7 +87,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(Boolean.TRUE, basic.getOptional()); basic.setOptional(Boolean.FALSE); @@ -101,7 +101,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(Boolean.TRUE, basic.getOptional()); basic.setOptional(null); @@ -116,7 +116,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(FetchType.EAGER, basic.getFetch()); } @@ -125,7 +125,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(FetchType.EAGER, basic.getFetch()); basic.setFetch(FetchType.LAZY); @@ -139,7 +139,7 @@ public class BasicTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - BasicAnnotation basic = (BasicAnnotation) attributeResource.getMappingAnnotation(JPA.BASIC); + BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC); assertEquals(FetchType.EAGER, basic.getFetch()); basic.setFetch(null); 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 f82a4966ea..5052b0ef37 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 @@ -110,7 +110,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } @@ -119,7 +119,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getName()); assertNull(column.getNullable()); @@ -134,7 +134,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getName()); @@ -149,7 +149,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(COLUMN_NAME, column.getName()); @@ -163,7 +163,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(COLUMN_TABLE, column.getTable()); } @@ -171,7 +171,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getTable()); @@ -190,7 +190,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithColumnDefinition(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } @@ -198,7 +198,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -217,7 +217,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithBooleanElement("unique"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Boolean.TRUE, column.getUnique()); } @@ -226,7 +226,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getUnique()); @@ -244,7 +244,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithBooleanElement("nullable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Boolean.TRUE, column.getNullable()); } @@ -253,7 +253,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getNullable()); @@ -271,7 +271,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithBooleanElement("insertable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Boolean.TRUE, column.getInsertable()); } @@ -280,7 +280,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getInsertable()); @@ -298,7 +298,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithBooleanElement("updatable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Boolean.TRUE, column.getUpdatable()); } @@ -307,7 +307,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getUpdatable()); @@ -325,7 +325,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithIntElement("length"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Integer.valueOf(5), column.getLength()); } @@ -334,7 +334,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertNull(column.getLength()); @@ -352,7 +352,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithIntElement("precision"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Integer.valueOf(5), column.getPrecision()); } @@ -361,7 +361,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertNotNull(column); assertEquals(null, column.getPrecision()); @@ -379,7 +379,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumnWithIntElement("scale"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals(Integer.valueOf(5), column.getScale()); } @@ -388,7 +388,7 @@ public class ColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(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 3ca4deeb88..38e47e8372 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 @@ -95,7 +95,7 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetName() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } @@ -103,7 +103,7 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetNull() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertNull(column.getName()); assertNull(column.getDiscriminatorType()); @@ -113,7 +113,7 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testSetName() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertNull(column.getName()); @@ -127,7 +127,7 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testSetNameNull() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(COLUMN_NAME, column.getName()); @@ -140,14 +140,14 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetColumnDefinition() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumnWithColumnDefinition(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } public void testSetColumnDefinition() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -165,7 +165,7 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetLength() throws Exception { ICompilationUnit cu = this.createTestColumnWithIntElement("length"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(Integer.valueOf(5), column.getLength()); } @@ -173,7 +173,7 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testSetLength() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertNotNull(column); assertNull(column.getLength()); @@ -190,14 +190,14 @@ public class DiscriminatorColumnTests extends JavaResourceModelTestCase { public void testGetDiscriminatorType() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumnWithDiscriminatorType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN); assertEquals(DiscriminatorType.CHAR, column.getDiscriminatorType()); } public void testSetDiscriminatorType() throws Exception { ICompilationUnit cu = this.createTestDiscriminatorColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_COLUMN); + DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(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 c5beed484f..542961c712 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 @@ -53,7 +53,7 @@ public class DiscriminatorValueTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestDiscriminatorValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_VALUE); + DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_VALUE); assertNotNull(discriminatorValue); } @@ -61,7 +61,7 @@ public class DiscriminatorValueTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestDiscriminatorValueWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_VALUE); + DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_VALUE); assertEquals("discriminator", discriminatorValue.getValue()); } @@ -69,7 +69,7 @@ public class DiscriminatorValueTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestDiscriminatorValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getSupportingAnnotation(JPA.DISCRIMINATOR_VALUE); + DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_VALUE); discriminatorValue.setValue("foo"); 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 6ad9f3b0c8..e1b69a0feb 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 @@ -56,7 +56,7 @@ public class EmbeddableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEmbeddable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof EmbeddableAnnotation); } @@ -64,10 +64,10 @@ public class EmbeddableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEmbeddableAndEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof EmbeddableAnnotation); - EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.getAnnotation(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 42acc30c0c..bcd884dc17 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 @@ -43,7 +43,7 @@ public class EmbeddedIdTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof EmbeddedIdAnnotation); } 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 f34354a840..98117ca0a7 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 @@ -43,7 +43,7 @@ public class EmbeddedTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof EmbeddedAnnotation); } 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 6297416b63..a958cbe45d 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 @@ -71,7 +71,7 @@ public class EntityTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEntityWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.getAnnotation(JPA.ENTITY); assertTrue(entity != null); assertEquals(ENTITY_NAME, entity.getName()); } @@ -80,7 +80,7 @@ public class EntityTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.getAnnotation(JPA.ENTITY); assertTrue(entity != null); assertNull(entity.getName()); } @@ -89,7 +89,7 @@ public class EntityTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.getAnnotation(JPA.ENTITY); assertNull(entity.getName()); entity.setName("Foo"); assertEquals("Foo", entity.getName()); @@ -101,7 +101,7 @@ public class EntityTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEntityWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - EntityAnnotation entity = (EntityAnnotation) typeResource.getMappingAnnotation(JPA.ENTITY); + EntityAnnotation entity = (EntityAnnotation) typeResource.getAnnotation(JPA.ENTITY); assertEquals(ENTITY_NAME, entity.getName()); entity.setName(null); @@ -115,10 +115,10 @@ public class EntityTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestMappedSuperclassAndEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof EntityAnnotation); - MappedSuperclassAnnotation mappedSuperclass = (MappedSuperclassAnnotation) typeResource.getMappingAnnotation(JPA.MAPPED_SUPERCLASS); + MappedSuperclassAnnotation mappedSuperclass = (MappedSuperclassAnnotation) typeResource.getAnnotation(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 919676c0f0..a17bf64a52 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 @@ -56,7 +56,7 @@ public class EnumeratedTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getSupportingAnnotation(JPA.ENUMERATED); + EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getAnnotation(JPA.ENUMERATED); assertNotNull(enumerated); } @@ -65,7 +65,7 @@ public class EnumeratedTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getSupportingAnnotation(JPA.ENUMERATED); + EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getAnnotation(JPA.ENUMERATED); assertEquals(EnumType.ORDINAL, enumerated.getValue()); } @@ -74,7 +74,7 @@ public class EnumeratedTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getSupportingAnnotation(JPA.ENUMERATED); + EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getAnnotation(JPA.ENUMERATED); enumerated.setValue(EnumType.STRING); 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 e65a912113..e32c0d03d7 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 @@ -70,7 +70,7 @@ public class GeneratedValueTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertNotNull(generatedValue); } @@ -79,7 +79,7 @@ public class GeneratedValueTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertEquals(GENERATOR, generatedValue.getGenerator()); } @@ -88,7 +88,7 @@ public class GeneratedValueTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertEquals(GENERATOR, generatedValue.getGenerator()); generatedValue.setGenerator("foo"); @@ -108,7 +108,7 @@ public class GeneratedValueTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE); assertEquals(GenerationType.SEQUENCE, generatedValue.getStrategy()); } @@ -117,7 +117,7 @@ public class GeneratedValueTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getSupportingAnnotation(JPA.GENERATED_VALUE); + GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(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 c6ce1260ff..af0079717e 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 @@ -55,7 +55,7 @@ public class IdClassTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestIdClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS); + IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getAnnotation(JPA.ID_CLASS); assertNotNull(idClass); assertNull(idClass.getValue()); } @@ -64,7 +64,7 @@ public class IdClassTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestIdClassWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS); + IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getAnnotation(JPA.ID_CLASS); assertEquals(ID_CLASS_VALUE, idClass.getValue()); } @@ -72,7 +72,7 @@ public class IdClassTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestIdClassWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS); + IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getAnnotation(JPA.ID_CLASS); assertEquals(ID_CLASS_VALUE, idClass.getValue()); idClass.setValue("foo"); @@ -84,7 +84,7 @@ public class IdClassTests extends JavaResourceModelTestCase { assertSourceDoesNotContain("@IdClass", cu); - idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS); + idClass = (IdClassAnnotation) typeResource.getAnnotation(JPA.ID_CLASS); assertNull(idClass); } @@ -92,7 +92,7 @@ public class IdClassTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestIdClassWithValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getSupportingAnnotation(JPA.ID_CLASS); + IdClassAnnotation idClass = (IdClassAnnotation) typeResource.getAnnotation(JPA.ID_CLASS); assertNotNull(idClass.getValue()); assertEquals("MyClass", idClass.getFullyQualifiedClassName()); //bug 196200 changed this 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 3574e4d649..9dd3c413e9 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 @@ -43,7 +43,7 @@ public class IdTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof IdAnnotation); } 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 d3901a3956..a40770ca29 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 @@ -54,7 +54,7 @@ public class InheritanceTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestInheritance(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(JPA.INHERITANCE); + InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getAnnotation(JPA.INHERITANCE); assertNotNull(inheritance); } @@ -62,7 +62,7 @@ public class InheritanceTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestInheritanceWithStrategy(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(JPA.INHERITANCE); + InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getAnnotation(JPA.INHERITANCE); assertEquals(InheritanceType.JOINED, inheritance.getStrategy()); } @@ -70,7 +70,7 @@ public class InheritanceTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestInheritance(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getSupportingAnnotation(JPA.INHERITANCE); + InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getAnnotation(JPA.INHERITANCE); inheritance.setStrategy(InheritanceType.TABLE_PER_CLASS); assertSourceContains("@Inheritance(strategy = TABLE_PER_CLASS)", cu); diff --git a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java index 1a8cb78a59..99e2328de6 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java @@ -19,6 +19,7 @@ import org.eclipse.jpt.core.internal.resource.java.source.SourceOneToOneAnnotati import org.eclipse.jpt.core.resource.java.AttributeOverrideAnnotation; import org.eclipse.jpt.core.resource.java.BasicAnnotation; import org.eclipse.jpt.core.resource.java.ColumnAnnotation; +import org.eclipse.jpt.core.resource.java.GeneratedValueAnnotation; import org.eclipse.jpt.core.resource.java.IdAnnotation; import org.eclipse.jpt.core.resource.java.JPA; import org.eclipse.jpt.core.resource.java.JavaResourceNode; @@ -346,21 +347,21 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = this.createTestEntityWithColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(1, attributeResource.supportingAnnotationsSize()); + assertEquals(1, attributeResource.annotationsSize()); } public void testJavaAttributeAnnotation() throws Exception { ICompilationUnit cu = this.createTestEntityWithColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); + assertNotNull(attributeResource.getAnnotation(JPA.COLUMN)); } public void testJavaAttributeAnnotationNull() throws Exception { ICompilationUnit cu = this.createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNull(attributeResource.getSupportingAnnotation(JPA.TABLE)); + assertNull(attributeResource.getAnnotation(JPA.TABLE)); } //This will result in a compilation error, but we assume the first column found @@ -368,7 +369,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = this.createTestEntityMultipleColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation columnResource = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation columnResource = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals("FOO", columnResource.getName()); } @@ -376,7 +377,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = this.createTestEntityWithColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - attributeResource.removeSupportingAnnotation(JPA.COLUMN); + attributeResource.removeAnnotation(JPA.COLUMN); assertSourceDoesNotContain("@Column", cu); } @@ -386,14 +387,14 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ColumnAnnotation columnResource = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation columnResource = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); columnResource.setTable(null); assertSourceContains("@Column(name = \"FOO\")", cu); columnResource.setName(null); assertSourceDoesNotContain("@Column", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.TABLE)); + assertNull(typeResource.getAnnotation(JPA.TABLE)); } public void testMultipleAttributeMappings() throws Exception { @@ -401,19 +402,18 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(2, attributeResource.mappingAnnotationsSize()); - assertEquals(0, attributeResource.supportingAnnotationsSize()); - assertNotNull(attributeResource.getMappingAnnotation(JPA.BASIC)); - assertNotNull(attributeResource.getMappingAnnotation(JPA.ID)); + assertEquals(2, attributeResource.annotationsSize()); + assertNotNull(attributeResource.getAnnotation(JPA.BASIC)); + assertNotNull(attributeResource.getAnnotation(JPA.ID)); - JavaResourceNode javaAttributeMappingAnnotation = attributeResource.getMappingAnnotation(); + JavaResourceNode javaAttributeMappingAnnotation = attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME); assertTrue(javaAttributeMappingAnnotation instanceof BasicAnnotation); assertSourceContains("@Basic", cu); assertSourceContains("@Id", cu); - attributeResource.setMappingAnnotation(JPA.ONE_TO_MANY); - assertEquals(1, attributeResource.mappingAnnotationsSize()); - javaAttributeMappingAnnotation = attributeResource.getMappingAnnotation(); + attributeResource.setPrimaryAnnotation(JPA.ONE_TO_MANY, new String[0]); + assertEquals(1, attributeResource.annotationsSize()); + javaAttributeMappingAnnotation = attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME); assertTrue(javaAttributeMappingAnnotation instanceof OneToManyAnnotation); assertSourceDoesNotContain("@Id", cu); assertSourceContains("@OneToMany", cu); @@ -424,10 +424,10 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = createTestType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(0, attributeResource.mappingAnnotationsSize()); + assertEquals(0, attributeResource.annotationsSize()); - attributeResource.setMappingAnnotation(JPA.ID); - assertTrue(attributeResource.getMappingAnnotation() instanceof IdAnnotation); + attributeResource.setPrimaryAnnotation(JPA.ID, new String[0]); + assertTrue(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME) instanceof IdAnnotation); assertSourceContains("@Id", cu); } @@ -435,10 +435,10 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = createTestEntityWithColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNull(attributeResource.getMappingAnnotation()); + assertEquals(1, attributeResource.annotationsSize()); - attributeResource.setMappingAnnotation(JPA.ID); - assertTrue(attributeResource.getMappingAnnotation() instanceof IdAnnotation); + attributeResource.setPrimaryAnnotation(JPA.ID, new String[] {ColumnAnnotation.ANNOTATION_NAME}); + assertTrue(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME) instanceof IdAnnotation); assertSourceContains("@Id", cu); assertSourceContains("@Column", cu); @@ -448,10 +448,14 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = createTestEntityWithIdColumnGeneratedValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertTrue(attributeResource.getMappingAnnotation() instanceof IdAnnotation); + assertTrue(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME) instanceof IdAnnotation); - attributeResource.setMappingAnnotation(JPA.BASIC); - assertTrue(attributeResource.getMappingAnnotation() instanceof BasicAnnotation); + attributeResource.setPrimaryAnnotation( + JPA.BASIC, + new String[] { + ColumnAnnotation.ANNOTATION_NAME, + GeneratedValueAnnotation.ANNOTATION_NAME}); + assertTrue(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME) instanceof BasicAnnotation); assertSourceDoesNotContain("@Id", cu); assertSourceContains("@GeneratedValue", cu); //not supported by Basic @@ -462,11 +466,15 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = createTestEntityWithIdColumnGeneratedValue(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertTrue(attributeResource.getMappingAnnotation() instanceof IdAnnotation); + assertTrue(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME) instanceof IdAnnotation); - attributeResource.setMappingAnnotation(null); - assertNull(attributeResource.getMappingAnnotation()); + attributeResource.setPrimaryAnnotation( + null, + new String[] { + ColumnAnnotation.ANNOTATION_NAME, + GeneratedValueAnnotation.ANNOTATION_NAME}); + assertEquals(2, attributeResource.annotationsSize()); assertSourceDoesNotContain("@Id", cu); assertSourceContains("@GeneratedValue", cu); //not supported by Basic assertSourceContains("@Column", cu); //common between Id and Basic @@ -479,7 +487,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertSourceDoesNotContain("@Column", cu); - attributeResource.addSupportingAnnotation(JPA.COLUMN); + attributeResource.addAnnotation(JPA.COLUMN); assertSourceContains("@Column", cu); } @@ -488,7 +496,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); assertSourceContains("@Column", cu); - attributeResource.removeSupportingAnnotation(JPA.COLUMN); + attributeResource.removeAnnotation(JPA.COLUMN); assertSourceDoesNotContain("@Column", cu); } @@ -512,9 +520,9 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC } }); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.COLUMN)); - assertNull(attributeResource.getMappingAnnotation(JPA.ID)); - assertNotNull(attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE)); + assertNotNull(attributeResource.getAnnotation(JPA.COLUMN)); + assertNull(attributeResource.getAnnotation(JPA.ID)); + assertNotNull(attributeResource.getAnnotation(JPA.ONE_TO_ONE)); assertSourceContains("@Column", cu); } @@ -523,9 +531,9 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(1, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertEquals(1, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); assertEquals("FOO", attributeOverride.getName()); } @@ -535,7 +543,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(0, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertEquals(0, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } public void testJavaAttributeAnnotationsContainerNoNestable() throws Exception { @@ -543,18 +551,18 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(0, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertEquals(0, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } public void testJavaAttributeAnnotationsNestableAndContainer() throws Exception { ICompilationUnit cu = createTestEmbeddedWithAttributeOverrideAndAttributeOverrides(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); - AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); + AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES).next(); assertEquals("BAR", attributeOverrideResource.getName()); } @@ -563,7 +571,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC ICompilationUnit cu = createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride.setName("FOO"); assertSourceContains("@AttributeOverride(name = \"FOO\")", cu); } @@ -575,13 +583,13 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(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\")})", cu); - assertNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } // @Embedded @@ -595,13 +603,13 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(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\")})", cu); - assertNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } public void testAddJavaAttributeAnnotationNestableContainer5() throws Exception { @@ -609,13 +617,13 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(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\")})", cu); - assertNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); } // @Embedded @@ -631,20 +639,20 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); - AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(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\"),", cu); assertSourceContains("@AttributeOverride})", cu); attributeOverride.setName("BOO"); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDE)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.ATTRIBUTE_OVERRIDES)); - assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE)); + assertNotNull(attributeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDES)); + assertEquals(3, CollectionTools.size(attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES))); - Iterator<NestableAnnotation> attributeOverrideAnnotations = attributeResource.supportingAnnotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + Iterator<NestableAnnotation> attributeOverrideAnnotations = attributeResource.annotations(JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); attributeOverride = (AttributeOverrideAnnotation) attributeOverrideAnnotations.next(); assertEquals("BAR", attributeOverride.getName()); attributeOverride = (AttributeOverrideAnnotation) attributeOverrideAnnotations.next(); @@ -663,7 +671,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertSourceDoesNotContain("@AttributeOverride", cu); } @@ -676,7 +684,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertSourceDoesNotContain("@AttributeOverride", cu); assertSourceDoesNotContain("@AttributeOverrides", cu); @@ -687,7 +695,7 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - attributeResource.removeSupportingAnnotation(0, JPA.ATTRIBUTE_OVERRIDE , JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE , JPA.ATTRIBUTE_OVERRIDES); assertSourceDoesNotContain("@AttributeOverride(name = \"FOO\"", cu); assertSourceContains("@AttributeOverride(name = \"BAR\"", cu); @@ -699,12 +707,12 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation)attributeResource.addSupportingAnnotation(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\"),", cu); assertSourceContains("@AttributeOverride(name = \"BAZ\")})", cu); - attributeResource.removeSupportingAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.removeAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"FOO\"), @AttributeOverride(name = \"BAZ\")})", cu); } @@ -713,13 +721,13 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation)attributeResource.addSupportingAnnotation(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\"),", cu); assertSourceContains("@AttributeOverride(name = \"BAZ\")})", cu); - attributeResource.moveSupportingAnnotation(0, 2, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.moveAnnotation(0, 2, JPA.ATTRIBUTE_OVERRIDES); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAZ\"), @AttributeOverride(name = \"FOO\"),", cu); assertSourceContains("@AttributeOverride(name = \"BAR\")})", cu); } @@ -729,12 +737,12 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - AttributeOverrideAnnotation newAnnotation = (AttributeOverrideAnnotation) attributeResource.addSupportingAnnotation(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\"),", cu); assertSourceContains("@AttributeOverride(name = \"BAZ\")})", cu); - attributeResource.moveSupportingAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES); + attributeResource.moveAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES); assertSourceContains("@AttributeOverrides({@AttributeOverride(name = \"BAR\"), @AttributeOverride(name = \"FOO\"),", cu); assertSourceContains("@AttributeOverride(name = \"BAZ\")})", cu); } @@ -815,11 +823,11 @@ public class JavaResourcePersistentAttributeTests extends JavaResourceModelTestC assertEquals(4, CollectionTools.size(typeResource.fields())); Iterator<JavaResourcePersistentAttribute> fields = typeResource.fields(); JavaResourcePersistentAttribute attributeResource = fields.next(); - ColumnAnnotation column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN); assertEquals("baz", column.getName()); attributeResource = fields.next(); - column = (ColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.COLUMN); + column = (ColumnAnnotation) attributeResource.getAnnotation(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/JavaResourcePersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java index 1ff5585102..c9954be080 100644 --- a/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java +++ b/jpa/tests/org.eclipse.jpt.core.tests/src/org/eclipse/jpt/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java @@ -10,7 +10,6 @@ package org.eclipse.jpt.core.tests.internal.resource.java; import java.util.Iterator; - import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jpt.core.internal.resource.java.source.SourceEmbeddableAnnotation; @@ -438,33 +437,33 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { public void testJavaTypeAnnotations() throws Exception { ICompilationUnit cu = this.createTestEntityWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(1, typeResource.supportingAnnotationsSize()); + assertEquals(2, typeResource.annotationsSize()); } public void testJavaTypeAnnotation() throws Exception { ICompilationUnit cu = this.createTestEntityWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertNotNull(typeResource.getSupportingAnnotation(JPA.TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.TABLE)); } public void testJavaTypeAnnotationNull() throws Exception { ICompilationUnit cu = this.createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertNull(typeResource.getSupportingAnnotation(JPA.TABLE)); + assertNull(typeResource.getAnnotation(JPA.TABLE)); } //This will result in a compilation error, but we assume the first table found public void testDuplicateAnnotations() throws Exception { ICompilationUnit cu = this.createTestEntityMultipleTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation tableResource = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableResource = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals("FOO", tableResource.getName()); } public void testRemoveTable() throws Exception { ICompilationUnit cu = this.createTestEntityWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - typeResource.removeSupportingAnnotation(JPA.TABLE); + typeResource.removeAnnotation(JPA.TABLE); assertSourceDoesNotContain("@Table", cu); } @@ -473,14 +472,14 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestEntityWithTable(); JavaResourcePersistentType jrpt = buildJavaTypeResource(cu); - TableAnnotation tableAnnotation = (TableAnnotation) jrpt.getSupportingAnnotation(JPA.TABLE); + TableAnnotation tableAnnotation = (TableAnnotation) jrpt.getAnnotation(JPA.TABLE); tableAnnotation.setSchema(null); assertSourceContains("@Table(name = \"FOO\")", cu); tableAnnotation.setName(null); assertSourceDoesNotContain("@Table", cu); - assertNull(jrpt.getSupportingAnnotation(JPA.TABLE)); + assertNull(jrpt.getAnnotation(JPA.TABLE)); } public void testMultipleTypeMappings() throws Exception { @@ -488,19 +487,18 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(2, typeResource.mappingAnnotationsSize()); - assertEquals(0, typeResource.supportingAnnotationsSize()); - assertNotNull(typeResource.getMappingAnnotation(JPA.EMBEDDABLE)); - assertNotNull(typeResource.getMappingAnnotation(JPA.ENTITY)); + assertEquals(2, typeResource.annotationsSize()); + assertNotNull(typeResource.getAnnotation(JPA.EMBEDDABLE)); + assertNotNull(typeResource.getAnnotation(JPA.ENTITY)); - JavaResourceNode javaTypeMappingAnnotation = typeResource.getMappingAnnotation(); + JavaResourceNode javaTypeMappingAnnotation = typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME); assertTrue(javaTypeMappingAnnotation instanceof EmbeddableAnnotation); assertSourceContains("@Entity", cu); assertSourceContains("@Embeddable", cu); - typeResource.setMappingAnnotation(JPA.MAPPED_SUPERCLASS); - assertEquals(1, typeResource.mappingAnnotationsSize()); - javaTypeMappingAnnotation = typeResource.getMappingAnnotation(); + typeResource.setPrimaryAnnotation(JPA.MAPPED_SUPERCLASS, new String[0]); + assertEquals(1, typeResource.annotationsSize()); + javaTypeMappingAnnotation = typeResource.getAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME); assertTrue(javaTypeMappingAnnotation instanceof MappedSuperclassAnnotation); assertSourceDoesNotContain("@Entity", cu); assertSourceContains("@MappedSuperclass", cu); @@ -510,31 +508,19 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { public void testSetJavaTypeMappingAnnotation() throws Exception { ICompilationUnit cu = createTestType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(0, typeResource.mappingAnnotationsSize()); + assertEquals(0, typeResource.annotationsSize()); - typeResource.setMappingAnnotation(JPA.ENTITY); - assertTrue(typeResource.getMappingAnnotation() instanceof EntityAnnotation); + typeResource.setPrimaryAnnotation(JPA.ENTITY, new String[0]); + assertTrue(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME) instanceof EntityAnnotation); assertSourceContains("@Entity", cu); } - public void testSetJavaTypeMappingAnnotation2() throws Exception { - ICompilationUnit cu = createTestEntityWithTable(); - JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertTrue(typeResource.getMappingAnnotation() instanceof EntityAnnotation); - - typeResource.setMappingAnnotation(JPA.EMBEDDABLE); - assertTrue(typeResource.getMappingAnnotation() instanceof EmbeddableAnnotation); - - assertSourceDoesNotContain("@Entity", cu); - assertSourceContains("@Table", cu); - } - public void testAddJavaTypeAnnotation() throws Exception { ICompilationUnit cu = createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); assertSourceDoesNotContain("@Table", cu); - typeResource.addSupportingAnnotation(JPA.TABLE); + typeResource.addAnnotation(JPA.TABLE); assertSourceContains("@Table", cu); } @@ -543,7 +529,7 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); assertSourceContains("@Table", cu); - typeResource.removeSupportingAnnotation(JPA.TABLE); + typeResource.removeAnnotation(JPA.TABLE); assertSourceDoesNotContain("@Table", cu); } @@ -566,9 +552,9 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { } }); - assertNotNull(typeResource.getSupportingAnnotation(JPA.TABLE)); - assertNull(typeResource.getMappingAnnotation(JPA.ENTITY)); - assertNotNull(typeResource.getMappingAnnotation(JPA.EMBEDDABLE)); + assertNotNull(typeResource.getAnnotation(JPA.TABLE)); + assertNull(typeResource.getAnnotation(JPA.ENTITY)); + assertNotNull(typeResource.getAnnotation(JPA.EMBEDDABLE)); assertSourceContains("@Table", cu); } @@ -576,9 +562,9 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(1, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertEquals(1, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals("FOO", secondaryTableResource.getName()); } @@ -587,25 +573,25 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(0, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertEquals(0, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testJavaTypeAnnotationsContainerNoNestable() throws Exception { ICompilationUnit cu = createTestEntityWithEmptySecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(0, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertEquals(0, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testJavaTypeAnnotationsNestableAndContainer() throws Exception { ICompilationUnit cu = createTestEntityWithSecondaryTableAndSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals("BAR", secondaryTableResource.getName()); } @@ -614,7 +600,7 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { public void testAddJavaTypeAnnotationNestableContainer() throws Exception { ICompilationUnit cu = createTestEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource.setName("FOO"); assertSourceContains("@SecondaryTable(name = \"FOO\")", cu); } @@ -625,13 +611,13 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } // @Entity @@ -644,45 +630,45 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testAddJavaTypeAnnotationNestableContainer5() throws Exception { ICompilationUnit cu = createTestEntityWithSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testAddJavaTypeAnnotationNestableContainer6() throws Exception { ICompilationUnit cu = createTestEntityWithSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } // @Entity @@ -697,19 +683,19 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithSecondaryTableAndSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - SecondaryTableAnnotation secondaryTableResource = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(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})", cu); secondaryTableResource.setName("BOO"); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); - Iterator<NestableAnnotation> secondaryTableAnnotations = typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + Iterator<NestableAnnotation> secondaryTableAnnotations = typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); secondaryTableResource = (SecondaryTableAnnotation) secondaryTableAnnotations.next(); assertEquals("BAR", secondaryTableResource.getName()); secondaryTableResource = (SecondaryTableAnnotation) secondaryTableAnnotations.next(); @@ -726,7 +712,7 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertSourceDoesNotContain("@SecondaryTable", cu); } @@ -738,7 +724,7 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWithSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertSourceDoesNotContain("@SecondaryTable", cu); assertSourceDoesNotContain("@SecondaryTables", cu); @@ -748,7 +734,7 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWith2SecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - typeResource.removeSupportingAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertSourceDoesNotContain("@SecondaryTable(name = \"FOO\"", cu); assertSourceContains("@SecondaryTable(name = \"BAR\"", cu); @@ -759,11 +745,11 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWith2SecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addSupportingAnnotation(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", cu); - typeResource.removeSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAZ\")})", cu); } @@ -771,11 +757,11 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWith2SecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addSupportingAnnotation(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\")})", cu); - typeResource.moveSupportingAnnotation(0, 2, JPA.SECONDARY_TABLES); + typeResource.moveAnnotation(0, 2, JPA.SECONDARY_TABLES); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAZ\"), @SecondaryTable(name = \"FOO\"), @SecondaryTable(name = \"BAR\")})", cu); } @@ -783,11 +769,11 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityWith2SecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation newAnnotation = (SecondaryTableAnnotation)typeResource.addSupportingAnnotation(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\")})", cu); - typeResource.moveSupportingAnnotation(2, 0, JPA.SECONDARY_TABLES); + typeResource.moveAnnotation(2, 0, JPA.SECONDARY_TABLES); assertSourceContains("@SecondaryTables({@SecondaryTable(name = \"BAR\"), @SecondaryTable(name = \"BAZ\"), @SecondaryTable(name = \"FOO\")})", cu); } @@ -803,12 +789,12 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestEntityDuplicates(); JavaResourcePersistentType persistentType = buildJavaTypeResource(cu); - EntityAnnotation javaTypeMappingAnnotation = (EntityAnnotation) persistentType.getMappingAnnotation(JPA.ENTITY); + EntityAnnotation javaTypeMappingAnnotation = (EntityAnnotation) persistentType.getAnnotation(JPA.ENTITY); assertEquals("FirstEntity", javaTypeMappingAnnotation.getName()); - assertEquals(1, persistentType.mappingAnnotationsSize()); + assertEquals(1, persistentType.annotationsSize()); - javaTypeMappingAnnotation = (EntityAnnotation) persistentType.getMappingAnnotation(); + javaTypeMappingAnnotation = (EntityAnnotation) persistentType.getAnnotation(EntityAnnotation.ANNOTATION_NAME); assertEquals("FirstEntity", javaTypeMappingAnnotation.getName()); } @@ -899,23 +885,23 @@ public class JavaResourcePersistentTypeTests extends JavaResourceModelTestCase { public void testAnnotatedMemberType() throws Exception { ICompilationUnit cu = this.createTestEntityWithMemberEmbeddable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertNotNull(typeResource.getMappingAnnotation(JPA.ENTITY)); - assertNull(typeResource.getMappingAnnotation(JPA.EMBEDDABLE)); + assertNotNull(typeResource.getAnnotation(JPA.ENTITY)); + assertNull(typeResource.getAnnotation(JPA.EMBEDDABLE)); JavaResourcePersistentType nestedType = typeResource.persistableTypes().next(); - assertNull(nestedType.getMappingAnnotation(JPA.ENTITY)); - assertNotNull(nestedType.getMappingAnnotation(JPA.EMBEDDABLE)); + assertNull(nestedType.getAnnotation(JPA.ENTITY)); + assertNotNull(nestedType.getAnnotation(JPA.EMBEDDABLE)); } public void testInvalidAnnotations() throws Exception { ICompilationUnit cu = this.createTestInvalidAnnotations(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - assertEquals(0, typeResource.mappingAnnotationsSize()); - assertEquals(0, typeResource.supportingAnnotationsSize()); + assertEquals(0, typeResource.annotationsSize()); + assertEquals(0, typeResource.annotationsSize()); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - assertEquals(0, attributeResource.mappingAnnotationsSize()); - assertEquals(0, attributeResource.supportingAnnotationsSize()); + assertEquals(0, attributeResource.annotationsSize()); + assertEquals(0, attributeResource.annotationsSize()); } } 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 7b5953c283..c17aff5f2d 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 @@ -111,7 +111,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } @@ -120,7 +120,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getName()); assertNull(column.getNullable()); @@ -136,7 +136,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getName()); @@ -151,7 +151,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(COLUMN_NAME, column.getName()); @@ -165,7 +165,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(COLUMN_TABLE, column.getTable()); } @@ -173,7 +173,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getTable()); @@ -192,7 +192,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithReferencedColumnName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName()); } @@ -200,7 +200,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getReferencedColumnName()); @@ -219,7 +219,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithColumnDefinition(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } @@ -227,7 +227,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -246,7 +246,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("unique"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(Boolean.TRUE, column.getUnique()); } @@ -255,7 +255,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getUnique()); @@ -273,7 +273,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("nullable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(Boolean.TRUE, column.getNullable()); } @@ -282,7 +282,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getNullable()); @@ -300,7 +300,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("insertable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(Boolean.TRUE, column.getInsertable()); } @@ -309,7 +309,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertNotNull(column); assertNull(column.getInsertable()); @@ -327,7 +327,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("updatable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(JPA.JOIN_COLUMN); assertEquals(Boolean.TRUE, column.getUpdatable()); } @@ -336,7 +336,7 @@ public class JoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.getAnnotation(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 8be5c3e571..6a489025f3 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 @@ -127,7 +127,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } @@ -136,7 +136,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getName()); assertNull(column.getNullable()); @@ -151,7 +151,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getName()); @@ -166,7 +166,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertEquals(COLUMN_NAME, column.getName()); @@ -180,7 +180,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertEquals(COLUMN_TABLE, column.getTable()); } @@ -188,7 +188,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getTable()); @@ -207,7 +207,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithReferencedColumnName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName()); } @@ -215,7 +215,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getReferencedColumnName()); @@ -234,7 +234,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithColumnDefinition(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } @@ -242,7 +242,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -261,7 +261,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("unique"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertTrue(column.getUnique().booleanValue()); } @@ -270,7 +270,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getUnique()); @@ -288,7 +288,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("nullable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertTrue(column.getNullable().booleanValue()); } @@ -297,7 +297,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getNullable()); @@ -315,7 +315,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("insertable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertTrue(column.getInsertable().booleanValue()); } @@ -324,7 +324,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getInsertable()); @@ -342,7 +342,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumnWithBooleanElement("updatable"); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertTrue(column.getUpdatable().booleanValue()); } @@ -351,7 +351,7 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); + JoinColumnAnnotation column = (JoinColumnAnnotation) attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getUpdatable()); @@ -372,13 +372,13 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(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\")})", cu); - assertNull(attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMN)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMNS)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS))); + assertNull(attributeResource.getAnnotation(JPA.JOIN_COLUMN)); + assertNotNull(attributeResource.getAnnotation(JPA.JOIN_COLUMNS)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS))); } public void testAddJoinColumnToBeginningOfList() throws Exception { @@ -386,22 +386,22 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(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\")})", cu); - joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(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\")})", cu); - Iterator<NestableAnnotation> joinColumns = attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + Iterator<NestableAnnotation> 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.getSupportingAnnotation(JPA.JOIN_COLUMN)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.JOIN_COLUMNS)); - assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS))); + assertNull(attributeResource.getAnnotation(JPA.JOIN_COLUMN)); + assertNotNull(attributeResource.getAnnotation(JPA.JOIN_COLUMNS)); + assertEquals(3, CollectionTools.size(attributeResource.annotations(JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS))); } @@ -410,11 +410,11 @@ public class JoinColumnsTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinColumnAnnotation joinColumn = (JoinColumnAnnotation) attributeResource.addSupportingAnnotation(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\")})", cu); - attributeResource.removeSupportingAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); + attributeResource.removeAnnotation(1, JPA.JOIN_COLUMN, JPA.JOIN_COLUMNS); assertSourceContains("@JoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", table = \"TABLE\", unique = false, nullable = false, insertable = false, updatable = false, referencedColumnName = \"REF_NAME\")", cu); } 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 ef488c5f90..45acbd521e 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 @@ -126,7 +126,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertEquals(TABLE_NAME, table.getName()); } @@ -136,7 +136,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertNull(table.getName()); assertNull(table.getCatalog()); @@ -148,7 +148,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertNull(table.getName()); @@ -163,7 +163,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(TABLE_NAME, table.getName()); table.setName(null); @@ -177,7 +177,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertEquals(CATALOG_NAME, table.getCatalog()); } @@ -187,7 +187,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertNull(table.getCatalog()); @@ -202,7 +202,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(CATALOG_NAME, table.getCatalog()); table.setCatalog(null); @@ -216,7 +216,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertEquals(SCHEMA_NAME, table.getSchema()); } @@ -226,7 +226,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertNotNull(table); assertNull(table.getSchema()); @@ -241,7 +241,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(SCHEMA_NAME, table.getSchema()); table.setSchema(null); @@ -255,7 +255,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(0, table.uniqueConstraintsSize()); } @@ -265,7 +265,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addUniqueConstraint(0); @@ -279,7 +279,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(3, table.uniqueConstraintsSize()); } @@ -289,7 +289,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1); @@ -307,7 +307,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals("BAR", table.uniqueConstraintAt(0).columnNames().next()); assertEquals("FOO", table.uniqueConstraintAt(1).columnNames().next()); assertEquals("BAZ", table.uniqueConstraintAt(2).columnNames().next()); @@ -334,7 +334,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertSourceContains("@JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu); table.moveUniqueConstraint(2, 0); @@ -346,7 +346,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertSourceContains("@JoinTable(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu); table.moveUniqueConstraint(0, 2); @@ -358,7 +358,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(0, table.joinColumnsSize()); } @@ -368,7 +368,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addJoinColumn(0); @@ -382,7 +382,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(2, table.joinColumnsSize()); } @@ -392,7 +392,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addJoinColumn(0).setName("FOO"); table.addJoinColumn(1); @@ -409,7 +409,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addJoinColumn(0).setName("FOO"); assertEquals("FOO", table.joinColumnAt(0).getName()); @@ -439,7 +439,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); JoinColumnAnnotation joinColumn = table.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setUnique(Boolean.FALSE); @@ -465,7 +465,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); JoinColumnAnnotation joinColumn = table.joinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); @@ -494,7 +494,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(2, table.joinColumnsSize()); @@ -513,7 +513,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(0, table.inverseJoinColumnsSize()); } @@ -523,7 +523,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(0); @@ -537,7 +537,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(2, table.inverseJoinColumnsSize()); } @@ -547,7 +547,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(0).setName("FOO"); table.addInverseJoinColumn(1); @@ -564,7 +564,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(2).setName("FOO"); Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns(); @@ -595,7 +595,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(0).setName("FOO"); Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns(); @@ -617,7 +617,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); table.addInverseJoinColumn(1).setName("FOO"); Iterator<JoinColumnAnnotation> inverseJoinColumns = table.inverseJoinColumns(); @@ -639,7 +639,7 @@ public class JoinTableTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getSupportingAnnotation(JPA.JOIN_TABLE); + JoinTableAnnotation table = (JoinTableAnnotation) attributeResource.getAnnotation(JPA.JOIN_TABLE); assertEquals(2, table.inverseJoinColumnsSize()); 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 908fd5a763..7c003a3610 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 @@ -42,7 +42,7 @@ public class LobTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - LobAnnotation lob = (LobAnnotation) attributeResource.getSupportingAnnotation(JPA.LOB); + LobAnnotation lob = (LobAnnotation) attributeResource.getAnnotation(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 91e8b65994..5bbba87e4a 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 @@ -121,7 +121,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertNotNull(manyToMany); } @@ -130,7 +130,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(FetchType.EAGER, manyToMany.getFetch()); } @@ -139,7 +139,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(FetchType.EAGER, manyToMany.getFetch()); manyToMany.setFetch(FetchType.LAZY); @@ -153,7 +153,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(FetchType.EAGER, manyToMany.getFetch()); manyToMany.setFetch(null); @@ -168,7 +168,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(TYPE_NAME, manyToMany.getTargetEntity()); } @@ -177,7 +177,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(TYPE_NAME, manyToMany.getTargetEntity()); manyToMany.setTargetEntity("Foo"); @@ -190,7 +190,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(TYPE_NAME, manyToMany.getTargetEntity()); manyToMany.setTargetEntity(null); @@ -205,7 +205,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(FULLY_QUALIFIED_TYPE_NAME, manyToMany.getFullyQualifiedTargetEntityClassName()); manyToMany.setTargetEntity("Foo"); @@ -222,7 +222,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals("foo", manyToMany.getMappedBy()); } @@ -231,7 +231,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals(null, manyToMany.getMappedBy()); } @@ -240,7 +240,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertNull(manyToMany.getMappedBy()); manyToMany.setMappedBy("bar"); assertEquals("bar", manyToMany.getMappedBy()); @@ -253,7 +253,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertEquals("foo", manyToMany.getMappedBy()); manyToMany.setMappedBy(null); @@ -268,7 +268,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadeAll()); manyToMany.setCascadeAll(true); @@ -282,7 +282,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadeMerge()); manyToMany.setCascadeMerge(true); @@ -296,7 +296,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadePersist()); manyToMany.setCascadePersist(true); @@ -310,7 +310,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadeRemove()); manyToMany.setCascadeRemove(true); @@ -324,7 +324,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertFalse(manyToMany.isCascadeRefresh()); manyToMany.setCascadeRefresh(true); @@ -338,7 +338,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertTrue(manyToMany.isCascadeAll()); manyToMany.setCascadeAll(true); @@ -363,7 +363,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertTrue(manyToMany.isCascadeMerge()); manyToMany.setCascadeMerge(false); //TODO should the resource model handle this and remove both MERGE @@ -381,7 +381,7 @@ public class ManyToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_MANY); + ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_MANY); assertTrue(manyToMany.isCascadeMerge()); assertTrue(manyToMany.isCascadeRemove()); 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 d11ab1494c..e76703b1bb 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 @@ -121,7 +121,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertNotNull(manyToOne); } @@ -130,7 +130,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(FetchType.EAGER, manyToOne.getFetch()); } @@ -139,7 +139,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(FetchType.EAGER, manyToOne.getFetch()); manyToOne.setFetch(FetchType.LAZY); @@ -153,7 +153,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(FetchType.EAGER, manyToOne.getFetch()); manyToOne.setFetch(null); @@ -169,7 +169,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(TYPE_NAME, manyToOne.getTargetEntity()); } @@ -178,7 +178,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(TYPE_NAME, manyToOne.getTargetEntity()); manyToOne.setTargetEntity("Foo"); @@ -191,7 +191,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(TYPE_NAME, manyToOne.getTargetEntity()); manyToOne.setTargetEntity(null); @@ -206,7 +206,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(FULLY_QUALIFIED_TYPE_NAME, manyToOne.getFullyQualifiedTargetEntityClassName()); manyToOne.setTargetEntity("Foo"); @@ -223,7 +223,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(Boolean.TRUE, manyToOne.getOptional()); } @@ -232,7 +232,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(Boolean.TRUE, manyToOne.getOptional()); manyToOne.setOptional(Boolean.FALSE); @@ -246,7 +246,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertEquals(Boolean.TRUE, manyToOne.getOptional()); manyToOne.setOptional(null); @@ -261,7 +261,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadeAll()); manyToOne.setCascadeAll(true); @@ -275,7 +275,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadeMerge()); manyToOne.setCascadeMerge(true); @@ -289,7 +289,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadePersist()); manyToOne.setCascadePersist(true); @@ -303,7 +303,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadeRemove()); manyToOne.setCascadeRemove(true); @@ -317,7 +317,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertFalse(manyToOne.isCascadeRefresh()); manyToOne.setCascadeRefresh(true); @@ -331,7 +331,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertTrue(manyToOne.isCascadeAll()); manyToOne.setCascadeAll(true); @@ -356,7 +356,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertTrue(manyToOne.isCascadeMerge()); manyToOne.setCascadeMerge(false);//TODO should the resource model handle this and remove both MERGE @@ -374,7 +374,7 @@ public class ManyToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getMappingAnnotation(JPA.MANY_TO_ONE); + ManyToOneAnnotation manyToOne = (ManyToOneAnnotation) attributeResource.getAnnotation(JPA.MANY_TO_ONE); assertTrue(manyToOne.isCascadeMerge()); assertTrue(manyToOne.isCascadeRemove()); 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 409de12160..0f3db8e7c4 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 @@ -55,7 +55,7 @@ public class MapKeyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(JPA.MAP_KEY); + MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getAnnotation(JPA.MAP_KEY); assertNotNull(mapKey); } @@ -64,7 +64,7 @@ public class MapKeyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(JPA.MAP_KEY); + MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getAnnotation(JPA.MAP_KEY); assertEquals("key", mapKey.getName()); } @@ -73,7 +73,7 @@ public class MapKeyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getSupportingAnnotation(JPA.MAP_KEY); + MapKeyAnnotation mapKey = (MapKeyAnnotation) attributeResource.getAnnotation(JPA.MAP_KEY); mapKey.setName("foo"); 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 5f20d3d322..726906a3f6 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 @@ -56,7 +56,7 @@ public class MappedSuperclassTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestMappedSuperclass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = typeResource.getAnnotation(MappedSuperclassAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof MappedSuperclassAnnotation); } @@ -64,10 +64,10 @@ public class MappedSuperclassTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestMappedSuperclassAndEntity(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - JavaResourceNode mappingAnnotation = typeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof EntityAnnotation); - MappedSuperclassAnnotation mappedSuperclass = (MappedSuperclassAnnotation) typeResource.getMappingAnnotation(JPA.MAPPED_SUPERCLASS); + MappedSuperclassAnnotation mappedSuperclass = (MappedSuperclassAnnotation) typeResource.getAnnotation(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 274a1b6a25..b18a3bed9e 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 @@ -114,7 +114,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertNotNull(namedQuery); } @@ -123,7 +123,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_NAME, namedQuery.getName()); } @@ -132,7 +132,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_NAME, namedQuery.getName()); @@ -151,7 +151,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_QUERY, namedQuery.getQuery()); } @@ -160,7 +160,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_QUERY, namedQuery.getQuery()); @@ -179,7 +179,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass()); } @@ -188,7 +188,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass()); @@ -207,7 +207,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertNotNull(namedQuery.getResultClass()); assertEquals("Result", namedQuery.getFullyQualifiedResultClassName());//bug 196200 changed this @@ -222,7 +222,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultSetMapping(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping()); } @@ -231,7 +231,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultSetMapping(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping()); @@ -250,7 +250,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(0, namedQuery.hintsSize()); @@ -260,7 +260,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0); @@ -273,7 +273,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(2, namedQuery.hintsSize()); @@ -283,7 +283,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("FOO"); @@ -300,7 +300,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -330,7 +330,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -353,7 +353,7 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES); + NamedNativeQueriesAnnotation namedQueries = (NamedNativeQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES); NamedNativeQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -376,46 +376,46 @@ public class NamedNativeQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES))); + assertNull(typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY)); + assertNotNull(typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES))); } public void testAddNamedNativeQueryToBeginningOfList() throws Exception { ICompilationUnit cu = createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - namedQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - Iterator<NestableAnnotation> namedQueries = typeResource.supportingAnnotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + Iterator<NestableAnnotation> 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.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERIES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES))); + assertNull(typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY)); + assertNotNull(typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERIES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES))); } public void testRemoveNamedNativeQueryCopyExisting() throws Exception { ICompilationUnit cu = createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - typeResource.removeSupportingAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); + typeResource.removeAnnotation(1, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES); assertSourceContains("@NamedNativeQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"), resultClass = Foo.class, resultSetMapping = \"mapping\")", cu); } } 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 79b0fe3d3b..d417de0445 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 @@ -97,7 +97,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertNotNull(namedQuery); } @@ -105,7 +105,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_NAME, namedQuery.getName()); } @@ -113,7 +113,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_NAME, namedQuery.getName()); namedQuery.setName("foo"); @@ -131,7 +131,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_QUERY, namedQuery.getQuery()); } @@ -139,7 +139,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_QUERY, namedQuery.getQuery()); namedQuery.setQuery("foo"); @@ -157,7 +157,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass()); } @@ -165,7 +165,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_RESULT_CLASS, namedQuery.getResultClass()); namedQuery.setResultClass("foo"); @@ -183,7 +183,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultClass(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertNotNull(namedQuery.getResultClass()); assertEquals("Result", namedQuery.getFullyQualifiedResultClassName());//bug 196200 changed this @@ -197,7 +197,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultSetMapping(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping()); } @@ -205,7 +205,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithResultSetMapping(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(QUERY_RESULT_SET_MAPPING, namedQuery.getResultSetMapping()); namedQuery.setResultSetMapping("foo"); @@ -223,7 +223,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(0, namedQuery.hintsSize()); } @@ -232,7 +232,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0); namedQuery.addHint(1); @@ -244,7 +244,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); assertEquals(2, namedQuery.hintsSize()); } @@ -254,7 +254,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0).setName("FOO"); namedQuery.addHint(1); @@ -270,7 +270,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -299,7 +299,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_NATIVE_QUERY); namedQuery.addHint(0).setName("BAZ"); @@ -321,7 +321,7 @@ public class NamedNativeQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedNativeQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_NATIVE_QUERY); + NamedNativeQueryAnnotation namedQuery = (NamedNativeQueryAnnotation) typeResource.getAnnotation(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 20796246b3..103cbe30d4 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 @@ -95,7 +95,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertNotNull(namedQuery); } @@ -104,7 +104,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_NAME, namedQuery.getName()); } @@ -113,7 +113,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_NAME, namedQuery.getName()); @@ -132,7 +132,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_QUERY, namedQuery.getQuery()); } @@ -141,7 +141,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(QUERY_QUERY, namedQuery.getQuery()); @@ -160,7 +160,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(0, namedQuery.hintsSize()); @@ -170,7 +170,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0); @@ -183,7 +183,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); assertEquals(2, namedQuery.hintsSize()); @@ -193,7 +193,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueries(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("FOO"); @@ -211,7 +211,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -240,7 +240,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -262,7 +262,7 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES); + NamedQueriesAnnotation namedQueries = (NamedQueriesAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERIES); NamedQueryAnnotation namedQuery = namedQueries.nestedAnnotations().next(); namedQuery.addHint(0).setName("BAZ"); @@ -284,47 +284,47 @@ public class NamedQueriesTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.NAMED_QUERY)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES))); + assertNull(typeResource.getAnnotation(JPA.NAMED_QUERY)); + assertNotNull(typeResource.getAnnotation(JPA.NAMED_QUERIES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES))); } public void testAddNamedQueryToBeginningOfList() throws Exception { ICompilationUnit cu = createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - Iterator<NestableAnnotation> namedQueries = typeResource.supportingAnnotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + Iterator<NestableAnnotation> 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.getSupportingAnnotation(JPA.NAMED_QUERY)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.NAMED_QUERIES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES))); + assertNull(typeResource.getAnnotation(JPA.NAMED_QUERY)); + assertNotNull(typeResource.getAnnotation(JPA.NAMED_QUERIES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.NAMED_QUERY, JPA.NAMED_QUERIES))); } public void testRemoveNamedQueryCopyExisting() throws Exception { ICompilationUnit cu = createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addSupportingAnnotation(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\")})", cu); - typeResource.removeSupportingAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); + typeResource.removeAnnotation(1, JPA.NAMED_QUERY, JPA.NAMED_QUERIES); assertSourceContains("@NamedQuery(name = \"foo\", query = \"bar\", hints = @QueryHint(name = \"BAR\", value = \"FOO\"))", cu); } 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 520c3c6425..254a62d4f1 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 @@ -79,7 +79,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertNotNull(namedQuery); } @@ -87,7 +87,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertEquals(QUERY_NAME, namedQuery.getName()); } @@ -95,7 +95,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertEquals(QUERY_NAME, namedQuery.getName()); namedQuery.setName("foo"); @@ -113,7 +113,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertEquals(QUERY_QUERY, namedQuery.getQuery()); } @@ -121,7 +121,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertEquals(QUERY_QUERY, namedQuery.getQuery()); namedQuery.setQuery("foo"); @@ -139,7 +139,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertEquals(0, namedQuery.hintsSize()); } @@ -148,7 +148,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); namedQuery.addHint(0); namedQuery.addHint(1); @@ -160,7 +160,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); assertEquals(2, namedQuery.hintsSize()); @@ -173,7 +173,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQuery(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); namedQuery.addHint(0).setName("FOO"); namedQuery.addHint(1); @@ -190,7 +190,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -218,7 +218,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); namedQuery.addHint(0).setName("BAZ"); assertEquals("BAZ", namedQuery.hintAt(0).getName()); @@ -239,7 +239,7 @@ public class NamedQueryTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(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 3040f80089..3b529fee48 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 @@ -121,7 +121,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertNotNull(oneToMany); } @@ -130,7 +130,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(FetchType.EAGER, oneToMany.getFetch()); } @@ -139,7 +139,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(FetchType.EAGER, oneToMany.getFetch()); oneToMany.setFetch(FetchType.LAZY); @@ -153,7 +153,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(FetchType.EAGER, oneToMany.getFetch()); oneToMany.setFetch(null); @@ -169,7 +169,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(TYPE_NAME, oneToMany.getTargetEntity()); } @@ -178,7 +178,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(TYPE_NAME, oneToMany.getTargetEntity()); oneToMany.setTargetEntity("Foo"); @@ -191,7 +191,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(TYPE_NAME, oneToMany.getTargetEntity()); oneToMany.setTargetEntity(null); @@ -206,7 +206,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(FULLY_QUALIFIED_TYPE_NAME, oneToMany.getFullyQualifiedTargetEntityClassName()); oneToMany.setTargetEntity("Foo"); @@ -223,7 +223,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals("foo", oneToMany.getMappedBy()); } @@ -233,7 +233,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals(null, oneToMany.getMappedBy()); } @@ -242,7 +242,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertNull(oneToMany.getMappedBy()); oneToMany.setMappedBy("bar"); assertEquals("bar", oneToMany.getMappedBy()); @@ -255,7 +255,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertEquals("foo", oneToMany.getMappedBy()); oneToMany.setMappedBy(null); @@ -270,7 +270,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadeAll()); oneToMany.setCascadeAll(true); @@ -284,7 +284,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadeMerge()); oneToMany.setCascadeMerge(true); @@ -298,7 +298,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadePersist()); oneToMany.setCascadePersist(true); @@ -312,7 +312,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadeRemove()); oneToMany.setCascadeRemove(true); @@ -326,7 +326,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertFalse(oneToMany.isCascadeRefresh()); oneToMany.setCascadeRefresh(true); @@ -340,7 +340,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertTrue(oneToMany.isCascadeAll()); oneToMany.setCascadeAll(true); @@ -365,7 +365,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertTrue(oneToMany.isCascadeMerge()); oneToMany.setCascadeMerge(false);//TODO should the resource model handle this and remove both MERGE @@ -383,7 +383,7 @@ public class OneToManyTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_MANY); + OneToManyAnnotation oneToMany = (OneToManyAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_MANY); assertTrue(oneToMany.isCascadeMerge()); assertTrue(oneToMany.isCascadeRemove()); 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 681f49478e..0997797956 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 @@ -134,7 +134,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertNotNull(oneToOne); } @@ -143,7 +143,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(FetchType.EAGER, oneToOne.getFetch()); } @@ -152,7 +152,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(FetchType.EAGER, oneToOne.getFetch()); oneToOne.setFetch(FetchType.LAZY); @@ -166,7 +166,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(FetchType.EAGER, oneToOne.getFetch()); oneToOne.setFetch(null); @@ -182,7 +182,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(TYPE_NAME, oneToOne.getTargetEntity()); } @@ -191,7 +191,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(TYPE_NAME, oneToOne.getTargetEntity()); oneToOne.setTargetEntity("Foo"); @@ -204,7 +204,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(TYPE_NAME, oneToOne.getTargetEntity()); oneToOne.setTargetEntity(null); @@ -219,7 +219,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(FULLY_QUALIFIED_TYPE_NAME, oneToOne.getFullyQualifiedTargetEntityClassName()); oneToOne.setTargetEntity("Foo"); @@ -236,7 +236,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(Boolean.TRUE, oneToOne.getOptional()); } @@ -245,7 +245,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(Boolean.TRUE, oneToOne.getOptional()); oneToOne.setOptional(Boolean.FALSE); @@ -259,7 +259,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(Boolean.TRUE, oneToOne.getOptional()); oneToOne.setOptional(null); @@ -274,7 +274,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals("foo", oneToOne.getMappedBy()); } @@ -283,7 +283,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals(null, oneToOne.getMappedBy()); } @@ -292,7 +292,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertNull(oneToOne.getMappedBy()); oneToOne.setMappedBy("bar"); assertEquals("bar", oneToOne.getMappedBy()); @@ -305,7 +305,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertEquals("foo", oneToOne.getMappedBy()); oneToOne.setMappedBy(null); @@ -320,7 +320,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadeAll()); oneToOne.setCascadeAll(true); @@ -334,7 +334,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadeMerge()); oneToOne.setCascadeMerge(true); @@ -348,7 +348,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadePersist()); oneToOne.setCascadePersist(true); @@ -362,7 +362,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadeRemove()); oneToOne.setCascadeRemove(true); @@ -376,7 +376,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertFalse(oneToOne.isCascadeRefresh()); oneToOne.setCascadeRefresh(true); @@ -390,7 +390,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertTrue(oneToOne.isCascadeAll()); oneToOne.setCascadeAll(true); @@ -415,7 +415,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertTrue(oneToOne.isCascadeMerge()); oneToOne.setCascadeMerge(false);//TODO should the resource model handle this and remove both MERGE @@ -433,7 +433,7 @@ public class OneToOneTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getMappingAnnotation(JPA.ONE_TO_ONE); + OneToOneAnnotation oneToOne = (OneToOneAnnotation) attributeResource.getAnnotation(JPA.ONE_TO_ONE); assertTrue(oneToOne.isCascadeMerge()); assertTrue(oneToOne.isCascadeRemove()); 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 55120e4a94..d403160318 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 @@ -55,7 +55,7 @@ public class OrderByTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(JPA.ORDER_BY); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(JPA.ORDER_BY); assertNotNull(orderBy); } @@ -64,7 +64,7 @@ public class OrderByTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(JPA.ORDER_BY); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(JPA.ORDER_BY); assertEquals("key", orderBy.getValue()); } @@ -73,7 +73,7 @@ public class OrderByTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getSupportingAnnotation(JPA.ORDER_BY); + OrderByAnnotation orderBy = (OrderByAnnotation) attributeResource.getAnnotation(JPA.ORDER_BY); orderBy.setValue("foo"); 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 025e347a3f..42177540e2 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 @@ -84,7 +84,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } @@ -93,7 +93,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertNull(column.getReferencedColumnName()); assertNull(column.getColumnDefinition()); @@ -103,7 +103,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertNull(column.getName()); @@ -118,7 +118,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals(COLUMN_NAME, column.getName()); @@ -134,7 +134,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithReferencedColumnName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName()); } @@ -142,7 +142,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertNotNull(column); assertNull(column.getReferencedColumnName()); @@ -161,7 +161,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithColumnDefinition(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } @@ -169,7 +169,7 @@ public class PrimaryKeyJoinColumnTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.getAnnotation(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 1e01f24d38..74f08302f7 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 @@ -100,7 +100,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertEquals(COLUMN_NAME, column.getName()); } @@ -109,7 +109,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).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()); @@ -120,7 +120,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getName()); @@ -135,7 +135,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertEquals(COLUMN_NAME, column.getName()); @@ -149,7 +149,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithReferencedColumnName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertEquals(COLUMN_REFERENCED_COLUMN_NAME, column.getReferencedColumnName()); } @@ -157,7 +157,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getReferencedColumnName()); @@ -176,7 +176,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumnWithColumnDefinition(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertEquals(COLUMN_COLUMN_DEFINITION, column.getColumnDefinition()); } @@ -184,7 +184,7 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestPrimaryKeyJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); + PrimaryKeyJoinColumnAnnotation column = (PrimaryKeyJoinColumnAnnotation) attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS).next(); assertNotNull(column); assertNull(column.getColumnDefinition()); @@ -205,35 +205,35 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(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\")})", cu); - assertNull(attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMNS)); - assertEquals(2, CollectionTools.size(attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS))); + assertNull(attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN)); + assertNotNull(attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMNS)); + assertEquals(2, CollectionTools.size(attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS))); } public void testAddPrimaryKeyJoinColumnToBeginningOfList() throws Exception { ICompilationUnit cu = createTestPrimaryKeyJoinColumn(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(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\")})", cu); - joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(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\")})", cu); - Iterator<NestableAnnotation> pkJoinColumns = attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + Iterator<NestableAnnotation> 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.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN)); - assertNotNull(attributeResource.getSupportingAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMNS)); - assertEquals(3, CollectionTools.size(attributeResource.supportingAnnotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS))); + assertNull(attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMN)); + assertNotNull(attributeResource.getAnnotation(JPA.PRIMARY_KEY_JOIN_COLUMNS)); + assertEquals(3, CollectionTools.size(attributeResource.annotations(JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS))); } public void testRemovePrimaryKeyJoinColumnCopyExisting() throws Exception { @@ -241,11 +241,11 @@ public class PrimaryKeyJoinColumnsTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - PrimaryKeyJoinColumnAnnotation joinColumn = (PrimaryKeyJoinColumnAnnotation) attributeResource.addSupportingAnnotation(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\")})", cu); - attributeResource.removeSupportingAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); + attributeResource.removeAnnotation(1, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS); assertSourceContains("@PrimaryKeyJoinColumn(name = \"BAR\", columnDefinition = \"COLUMN_DEF\", referencedColumnName = \"REF_NAME\")", cu); } 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 b522972feb..1a61a2a98b 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 @@ -44,7 +44,7 @@ public class QueryHintTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); QueryHintAnnotation queryHint = namedQuery.hints().next(); assertEquals(QUERY_HINT_NAME, queryHint.getName()); } @@ -53,7 +53,7 @@ public class QueryHintTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestNamedQueryWithQueryHints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getSupportingAnnotation(JPA.NAMED_QUERY); + NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.getAnnotation(JPA.NAMED_QUERY); QueryHintAnnotation queryHint = namedQuery.hints().next(); assertEquals(QUERY_HINT_NAME, queryHint.getName()); 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 357596a1f6..3ed657cfde 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 @@ -111,7 +111,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertEquals(TABLE_NAME, table.getName()); } @@ -120,7 +120,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertNull(table.getName()); assertNull(table.getCatalog()); @@ -131,7 +131,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertNull(table.getName()); @@ -145,7 +145,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(TABLE_NAME, table.getName()); table.setName(null); @@ -158,7 +158,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertEquals(CATALOG_NAME, table.getCatalog()); } @@ -167,7 +167,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertNull(table.getCatalog()); @@ -181,7 +181,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(CATALOG_NAME, table.getCatalog()); table.setCatalog(null); @@ -194,7 +194,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertEquals(SCHEMA_NAME, table.getSchema()); } @@ -203,7 +203,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNotNull(table); assertNull(table.getSchema()); @@ -217,7 +217,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(SCHEMA_NAME, table.getSchema()); table.setSchema(null); @@ -230,7 +230,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testUniqueConstraints() throws Exception { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(0, table.uniqueConstraintsSize()); } @@ -238,7 +238,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testUniqueConstraints2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.addUniqueConstraint(0); table.addUniqueConstraint(1); @@ -249,7 +249,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testUniqueConstraints3() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(3, table.uniqueConstraintsSize()); } @@ -257,7 +257,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testAddUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1); @@ -273,7 +273,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.removeUniqueConstraint(1); Iterator<UniqueConstraintAnnotation> uniqueConstraints = table.uniqueConstraints(); @@ -297,7 +297,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next()); assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next()); @@ -315,7 +315,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals("BAR", secondaryTable.uniqueConstraintAt(0).columnNames().next()); assertEquals("FOO", secondaryTable.uniqueConstraintAt(1).columnNames().next()); @@ -334,7 +334,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testPkJoinColumns() throws Exception { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(0, table.pkJoinColumnsSize()); } @@ -342,7 +342,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testPkJoinColumns2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.addPkJoinColumn(0); table.addPkJoinColumn(1); @@ -353,7 +353,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testPkJoinColumns3() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(3, table.pkJoinColumnsSize()); } @@ -361,7 +361,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testAddPkJoinColumn() throws Exception { ICompilationUnit cu = this.createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.addPkJoinColumn(0).setName("FOO"); @@ -379,7 +379,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testRemovePkJoinColumn() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); table.removePkJoinColumn(1); assertSourceContains("@SecondaryTable(pkJoinColumns = {@PrimaryKeyJoinColumn(name = \"BAR\"), @PrimaryKeyJoinColumn(name = \"BAZ\")})", cu); @@ -395,7 +395,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testMovePkJoinColumn() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0); joinColumn.setReferencedColumnName("REF_NAME"); joinColumn.setColumnDefinition("COLUMN_DEF"); @@ -406,7 +406,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testMovePkJoinColumn2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0); @@ -419,7 +419,7 @@ public class SecondaryTableTests extends JavaResourceModelTestCase { public void testSetPkJoinColumnName() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertEquals(3, table.pkJoinColumnsSize()); 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 278f0f0f75..1cc9a47435 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 @@ -129,9 +129,9 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLE); assertNull(table); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); assertNotNull(secondaryTables); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); @@ -142,7 +142,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertNull(secondaryTable.getName()); assertNull(secondaryTable.getCatalog()); @@ -153,7 +153,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertNull(secondaryTable.getName()); @@ -168,7 +168,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertEquals(TABLE_NAME, secondaryTable.getName()); @@ -182,7 +182,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertEquals(CATALOG_NAME, secondaryTable.getCatalog()); } @@ -191,7 +191,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertNull(secondaryTable.getCatalog()); @@ -205,7 +205,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertEquals(CATALOG_NAME, secondaryTable.getCatalog()); @@ -219,7 +219,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertNotNull(secondaryTable); assertEquals(SCHEMA_NAME, secondaryTable.getSchema()); @@ -229,7 +229,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertNull(secondaryTable.getSchema()); @@ -243,7 +243,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSecondaryTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertEquals(SCHEMA_NAME, secondaryTable.getSchema()); @@ -257,7 +257,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testUniqueConstraints() throws Exception { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertEquals(0, secondaryTable.uniqueConstraintsSize()); @@ -266,7 +266,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testUniqueConstraints2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); secondaryTable.addUniqueConstraint(0); @@ -278,7 +278,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testUniqueConstraints3() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); assertEquals(2, secondaryTable.uniqueConstraintsSize()); @@ -287,7 +287,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testAddUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); secondaryTable.addUniqueConstraint(0).addColumnName("FOO"); @@ -304,7 +304,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); secondaryTable.addUniqueConstraint(0).addColumnName("FOO"); @@ -321,7 +321,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); secondaryTable.addUniqueConstraint(0).addColumnName("FOO"); @@ -339,7 +339,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES); + SecondaryTablesAnnotation secondaryTables = (SecondaryTablesAnnotation) typeResource.getAnnotation(JPA.SECONDARY_TABLES); SecondaryTableAnnotation secondaryTable = secondaryTables.nestedAnnotations().next(); secondaryTable.addUniqueConstraint(0).addColumnName("FOO"); @@ -361,46 +361,46 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { ICompilationUnit cu = createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(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\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\")),@SecondaryTable(name = \"BAR\")})", cu); - assertNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(2, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(2, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testAddSecondaryTable() throws Exception { ICompilationUnit cu = createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(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\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\")),@SecondaryTable(name = \"BAR\")})", cu); - secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(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\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\")), @SecondaryTable(name = \"BAR\")})", cu); - Iterator<NestableAnnotation> secondaryTables = typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + Iterator<NestableAnnotation> 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.getSupportingAnnotation(JPA.SECONDARY_TABLE)); - assertNotNull(typeResource.getSupportingAnnotation(JPA.SECONDARY_TABLES)); - assertEquals(3, CollectionTools.size(typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); + assertNull(typeResource.getAnnotation(JPA.SECONDARY_TABLE)); + assertNotNull(typeResource.getAnnotation(JPA.SECONDARY_TABLES)); + assertEquals(3, CollectionTools.size(typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES))); } public void testRemoveSecondaryTableCopyExisting() throws Exception { ICompilationUnit cu = createTestSecondaryTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addSupportingAnnotation(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\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\")),@SecondaryTable(name = \"BAR\")})", cu); - typeResource.removeSupportingAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); + typeResource.removeAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES); assertSourceContains("@SecondaryTable(name = \"FOO\", schema = \"BAZ\", catalog = \"BAR\", uniqueConstraints = @UniqueConstraint(columnNames = \"BAR\"))", cu); } @@ -408,7 +408,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testPkJoinColumns() throws Exception { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals(0, table.pkJoinColumnsSize()); } @@ -416,7 +416,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testPkJoinColumns2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); table.addPkJoinColumn(0); table.addPkJoinColumn(1); @@ -427,7 +427,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testPkJoinColumns3() throws Exception { ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals(3, table.pkJoinColumnsSize()); } @@ -435,7 +435,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testAddPkJoinColumn() throws Exception { ICompilationUnit cu = this.createTestSecondaryTables(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); table.addPkJoinColumn(0).setName("FOO"); table.addPkJoinColumn(1); @@ -447,7 +447,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testRemovePkJoinColumn() throws Exception { ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + 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\")}))", cu); @@ -462,7 +462,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testMovePkJoinColumn() throws Exception { ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + 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"); @@ -473,7 +473,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testMovePkJoinColumn2() throws Exception { ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); PrimaryKeyJoinColumnAnnotation joinColumn = table.pkJoinColumnAt(0); @@ -486,7 +486,7 @@ public class SecondaryTablesTests extends JavaResourceModelTestCase { public void testSetPkJoinColumnName() throws Exception { ICompilationUnit cu = this.createTestSecondaryTablesWithPkJoinColumns(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.supportingAnnotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); + SecondaryTableAnnotation table = (SecondaryTableAnnotation) typeResource.annotations(JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES).next(); assertEquals(3, table.pkJoinColumnsSize()); 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 bf2c26bbb0..d660df6c06 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 @@ -103,7 +103,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertNotNull(sequenceGenerator); } @@ -111,7 +111,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestSequenceGeneratorOnType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) typeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) typeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertNotNull(sequenceGenerator); } @@ -120,7 +120,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_NAME, sequenceGenerator.getName()); } @@ -129,7 +129,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_NAME, sequenceGenerator.getName()); sequenceGenerator.setName("foo"); @@ -148,7 +148,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_SEQUENCE_NAME, sequenceGenerator.getSequenceName()); } @@ -157,7 +157,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_SEQUENCE_NAME, sequenceGenerator.getSequenceName()); sequenceGenerator.setSequenceName("foo"); @@ -176,7 +176,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_ALLOCATION_SIZE, sequenceGenerator.getAllocationSize()); } @@ -185,7 +185,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_ALLOCATION_SIZE, sequenceGenerator.getAllocationSize()); sequenceGenerator.setAllocationSize(Integer.valueOf(500)); @@ -206,7 +206,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR); assertEquals(GENERATOR_INITIAL_VALUE, sequenceGenerator.getInitialValue()); } @@ -215,7 +215,7 @@ public class SequenceGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.SEQUENCE_GENERATOR); + SequenceGeneratorAnnotation sequenceGenerator = (SequenceGeneratorAnnotation) attributeResource.getAnnotation(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 c4067dec1c..f5c5f04816 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 @@ -139,7 +139,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertNotNull(tableGenerator); } @@ -147,7 +147,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableGeneratorOnType(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) typeResource.getAnnotation(JPA.TABLE_GENERATOR); assertNotNull(tableGenerator); } @@ -156,7 +156,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_NAME, tableGenerator.getName()); } @@ -165,7 +165,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_NAME, tableGenerator.getName()); tableGenerator.setName("foo"); @@ -184,7 +184,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_TABLE, tableGenerator.getTable()); } @@ -193,7 +193,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_TABLE, tableGenerator.getTable()); tableGenerator.setTable("foo"); @@ -212,7 +212,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_CATALOG, tableGenerator.getCatalog()); } @@ -221,7 +221,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_CATALOG, tableGenerator.getCatalog()); tableGenerator.setCatalog("foo"); @@ -240,7 +240,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_SCHEMA, tableGenerator.getSchema()); } @@ -249,7 +249,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_SCHEMA, tableGenerator.getSchema()); tableGenerator.setSchema("foo"); @@ -268,7 +268,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_PK_COLUMN_NAME, tableGenerator.getPkColumnName()); } @@ -277,7 +277,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_PK_COLUMN_NAME, tableGenerator.getPkColumnName()); tableGenerator.setPkColumnName("foo"); @@ -296,7 +296,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_VALUE_COLUMN_NAME, tableGenerator.getValueColumnName()); } @@ -305,7 +305,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_VALUE_COLUMN_NAME, tableGenerator.getValueColumnName()); tableGenerator.setValueColumnName("foo"); @@ -324,7 +324,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_PK_COLUMN_VALUE, tableGenerator.getPkColumnValue()); } @@ -333,7 +333,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_PK_COLUMN_VALUE, tableGenerator.getPkColumnValue()); tableGenerator.setPkColumnValue("foo"); @@ -352,7 +352,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_ALLOCATION_SIZE, tableGenerator.getAllocationSize()); } @@ -361,7 +361,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_ALLOCATION_SIZE, tableGenerator.getAllocationSize()); tableGenerator.setAllocationSize(Integer.valueOf(500)); @@ -382,7 +382,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_INITIAL_VALUE, tableGenerator.getInitialValue()); } @@ -391,7 +391,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(GENERATOR_INITIAL_VALUE, tableGenerator.getInitialValue()); tableGenerator.setInitialValue(Integer.valueOf(500)); @@ -412,7 +412,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(0, tableGenerator.uniqueConstraintsSize()); } @@ -422,7 +422,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.addUniqueConstraint(0); tableGenerator.addUniqueConstraint(1); @@ -435,7 +435,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); assertEquals(3, tableGenerator.uniqueConstraintsSize()); } @@ -445,7 +445,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.addUniqueConstraint(0).addColumnName("FOO"); tableGenerator.addUniqueConstraint(1); @@ -464,7 +464,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.removeUniqueConstraint(1); assertSourceContains("@TableGenerator(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu); @@ -481,7 +481,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.moveUniqueConstraint(2, 0); assertSourceContains("@TableGenerator(uniqueConstraints = {@UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"})})", cu); @@ -492,7 +492,7 @@ public class TableGeneratorTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getSupportingAnnotation(JPA.TABLE_GENERATOR); + TableGeneratorAnnotation tableGenerator = (TableGeneratorAnnotation) attributeResource.getAnnotation(JPA.TABLE_GENERATOR); tableGenerator.moveUniqueConstraint(0, 2); assertSourceContains("@TableGenerator(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"})})", cu); 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 a2cf4d9c83..2fce6fb645 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 @@ -97,7 +97,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertEquals(TABLE_NAME, table.getName()); } @@ -106,7 +106,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertNull(table.getName()); assertNull(table.getCatalog()); @@ -117,7 +117,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertNull(table.getName()); @@ -131,7 +131,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableWithName(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals(TABLE_NAME, table.getName()); table.setName(null); @@ -144,7 +144,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertEquals(CATALOG_NAME, table.getCatalog()); } @@ -153,7 +153,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertNull(table.getCatalog()); @@ -167,7 +167,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableWithCatalog(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals(CATALOG_NAME, table.getCatalog()); table.setCatalog(null); @@ -180,7 +180,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertEquals(SCHEMA_NAME, table.getSchema()); } @@ -189,7 +189,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertNotNull(table); assertNull(table.getSchema()); @@ -203,7 +203,7 @@ public class TableTests extends JavaResourceModelTestCase { ICompilationUnit cu = this.createTestTableWithSchema(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals(SCHEMA_NAME, table.getSchema()); table.setSchema(null); @@ -215,7 +215,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testUniqueConstraints() throws Exception { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals(0, table.uniqueConstraintsSize()); } @@ -223,7 +223,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testUniqueConstraints2() throws Exception { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.addUniqueConstraint(0); table.addUniqueConstraint(1); @@ -234,7 +234,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testUniqueConstraints3() throws Exception { ICompilationUnit cu = this.createTestTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); assertEquals(3, table.uniqueConstraintsSize()); } @@ -242,7 +242,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testAddUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1); @@ -258,7 +258,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testAddUniqueConstraint2() throws Exception { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(0); @@ -275,7 +275,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.removeUniqueConstraint(1); assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"BAZ\"})})", cu); @@ -290,7 +290,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint2() throws Exception { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1).addColumnName("BAR"); table.addUniqueConstraint(2).addColumnName("BAZ"); @@ -309,7 +309,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testRemoveUniqueConstraint3() throws Exception { ICompilationUnit cu = this.createTestTable(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.addUniqueConstraint(0).addColumnName("FOO"); table.addUniqueConstraint(1).addColumnName("BAR"); table.addUniqueConstraint(2).addColumnName("BAZ"); @@ -328,7 +328,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint() throws Exception { ICompilationUnit cu = this.createTestTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.moveUniqueConstraint(2, 0); assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {\"FOO\"}), @UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"})})", cu); @@ -337,7 +337,7 @@ public class TableTests extends JavaResourceModelTestCase { public void testMoveUniqueConstraint2() throws Exception { ICompilationUnit cu = this.createTestTableWithUniqueConstraints(); JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); - TableAnnotation table = (TableAnnotation) typeResource.getSupportingAnnotation(JPA.TABLE); + TableAnnotation table = (TableAnnotation) typeResource.getAnnotation(JPA.TABLE); table.moveUniqueConstraint(0, 2); assertSourceContains("@Table(uniqueConstraints = {@UniqueConstraint(columnNames = {\"BAZ\"}), @UniqueConstraint(columnNames = {\"BAR\"}), @UniqueConstraint(columnNames = {\"FOO\"})})", cu); 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 0769884ced..a75771b225 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 @@ -56,7 +56,7 @@ public class TemporalTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(JPA.TEMPORAL); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(JPA.TEMPORAL); assertNotNull(temporal); } @@ -65,7 +65,7 @@ public class TemporalTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(JPA.TEMPORAL); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(JPA.TEMPORAL); assertEquals(TemporalType.DATE, temporal.getValue()); } @@ -74,7 +74,7 @@ public class TemporalTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getSupportingAnnotation(JPA.TEMPORAL); + TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(JPA.TEMPORAL); temporal.setValue(TemporalType.TIME); 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 e268318116..d12522fd48 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 @@ -43,7 +43,7 @@ public class TransientTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof TransientAnnotation); } 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 5abf709599..82e5288290 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 @@ -43,7 +43,7 @@ public class VersionTests extends JavaResourceModelTestCase { JavaResourcePersistentType typeResource = buildJavaTypeResource(cu); JavaResourcePersistentAttribute attributeResource = typeResource.fields().next(); - JavaResourceNode mappingAnnotation = attributeResource.getMappingAnnotation(); + JavaResourceNode mappingAnnotation = attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME); assertTrue(mappingAnnotation instanceof VersionAnnotation); } } |