Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2011-08-01 15:10:18 +0000
committerkmoore2011-08-01 15:10:18 +0000
commitc7a08672e168714087c16ed7123975c92c21d7d9 (patch)
treec9cbd3a49133c49f67cd31001507066e9c0a595f /jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa
parent188fe8a8a0f3f5e21db478434744dd8756739a4f (diff)
downloadwebtools.dali-c7a08672e168714087c16ed7123975c92c21d7d9.tar.gz
webtools.dali-c7a08672e168714087c16ed7123975c92c21d7d9.tar.xz
webtools.dali-c7a08672e168714087c16ed7123975c92c21d7d9.zip
consolidation of the java resource model for JAXB and JPA. Changing API to Iterables instead of Iterators
Diffstat (limited to 'jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa')
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/ContextModelTestCase.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaFileTests.java24
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java143
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java197
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaAssociationOverrideTests.java121
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaAttributeOverrideTests.java67
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaBasicMappingTests.java440
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaCascadeTests.java87
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaColumnTests.java249
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java55
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddableTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java313
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddedMappingTests.java320
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEntityTests.java1160
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaGeneratedValueTests.java39
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaIdMappingTests.java339
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaJoinColumnTests.java173
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaJoinTableTests.java430
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaManyToManyMappingTests.java359
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaManyToOneMappingTests.java340
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaMappedSuperclassTests.java35
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaNamedNativeQueryTests.java111
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaNamedQueryTests.java75
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaOneToManyMappingTests.java347
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaOneToOneMappingTests.java549
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java77
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaQueryHintTests.java45
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaSecondaryTableTests.java295
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaSequenceGeneratorTests.java57
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableGeneratorTests.java193
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableTests.java149
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTransientMappingTests.java107
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaVersionMappingTests.java175
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/EntityMappingsTests.java92
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java117
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java28
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAssociationOverrideTests.java36
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAttributeOverrideTests.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmBasicMappingTests.java54
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmColumnTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java142
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java152
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEntityTests.java336
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmGeneratedValueTests.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java58
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinColumnTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinTableTests.java100
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToManyMappingTests.java57
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToOneMappingTests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToManyMappingTests.java55
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToOneMappingTests.java81
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSecondaryTableTests.java100
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableTests.java32
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTransientMappingTests.java52
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmVersionMappingTests.java52
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmXmlTests.java4
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/ClassRefTests.java12
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/MappingFileRefTests.java8
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceTests.java24
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceUnitTests.java102
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaAssociationOverride2_0Tests.java143
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaCascade2_0Tests.java23
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaCollectionTable2_0Tests.java307
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0Tests.java672
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaEmbeddedMapping2_0Tests.java533
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaEntity2_0Tests.java608
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaManyToManyMapping2_0Tests.java272
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaManyToOneMapping2_0Tests.java180
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaOneToManyMapping2_0Tests.java368
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaOneToOneMapping2_0Tests.java274
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0Tests.java18
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaPersistentType2_0Tests.java90
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0Tests.java27
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmAssociationOverride2_0Tests.java70
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCollectionTable2_0Tests.java70
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java140
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmEmbeddedMapping2_0Tests.java326
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmEntity2_0Tests.java290
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmManyToManyMapping2_0Tests.java22
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmManyToOneMapping2_0Tests.java29
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmOneToManyMapping2_0Tests.java34
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmOneToOneMapping2_0Tests.java33
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0Tests.java219
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmPersistentType2_0Tests.java40
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/Access2_0AnnotationTests.java52
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/AssociationOverride2_0Tests.java342
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/AssociationOverrides2_0Tests.java445
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/Cacheable2_0AnnotationTests.java30
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/CollectionTable2_0AnnotationTests.java211
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/ElementCollection2_0AnnotationTests.java55
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/JavaResourceModel2_0TestCase.java10
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/ManyToMany2_0AnnotationTests.java133
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/ManyToOne2_0AnnotationTests.java127
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapKeyClass2_0AnnotationTests.java31
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationTests.java139
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationTests.java26
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationTests.java120
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationTests.java190
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationTests.java25
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapsId2_0AnnotationTests.java25
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/OneToMany2_0AnnotationTests.java133
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/OneToOne2_0AnnotationTests.java153
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/OrderColumn2_0AnnotationTests.java89
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationTests.java37
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/AssociationOverrideTests.java106
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/AssociationOverridesTests.java170
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/AttributeOverrideTests.java62
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/AttributeOverridesTests.java120
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/BasicTests.java49
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/ColumnTests.java139
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/DiscriminatorColumnTests.java44
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/DiscriminatorValueTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/EmbeddableTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/EmbeddedIdTests.java15
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/EmbeddedTests.java15
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/EntityTests.java29
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/EnumeratedTests.java25
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/GeneratedValueTests.java37
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/IdClassTests.java20
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/IdTests.java15
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/InheritanceTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JavaResourceAttributeTests.java (renamed from jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java)446
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JavaResourceModelTestCase.java37
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JavaResourceTypeTests.java (renamed from jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java)490
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JoinColumnTests.java115
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JoinColumnsTests.java190
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JoinTableTests.java284
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JptJavaResourceTests.java6
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/LobTests.java13
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/ManyToManyTests.java127
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/ManyToOneTests.java121
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/MapKeyTests.java25
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/MappedSuperclassTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/NamedNativeQueriesTests.java182
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/NamedNativeQueryTests.java94
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/NamedQueriesTests.java158
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/NamedQueryTests.java78
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/OneToManyTests.java127
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/OneToOneTests.java145
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/OrderByTests.java25
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java55
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java123
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/QueryHintTests.java16
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/SecondaryTableTests.java172
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/SecondaryTablesTests.java234
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/SequenceGeneratorTests.java66
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/TableGeneratorTests.java181
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/TableTests.java100
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/TemporalTests.java25
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/TransientTests.java15
-rw-r--r--jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/VersionTests.java15
153 files changed, 10251 insertions, 10357 deletions
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/ContextModelTestCase.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/ContextModelTestCase.java
index 1d312fb923..4d321e3119 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/ContextModelTestCase.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/ContextModelTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -148,7 +148,7 @@ public abstract class ContextModelTestCase extends AnnotationTestCase
}
protected MappingFile getMappingFile() {
- return this.getPersistenceUnit().mappingFileRefs().next().getMappingFile();
+ return this.getPersistenceUnit().getMappingFileRefs().iterator().next().getMappingFile();
}
protected EntityMappings getEntityMappings() {
@@ -161,11 +161,11 @@ public abstract class ContextModelTestCase extends AnnotationTestCase
}
protected PersistenceUnit getPersistenceUnit() {
- return getRootContextNode().getPersistenceXml().getPersistence().persistenceUnits().next();
+ return getRootContextNode().getPersistenceXml().getPersistence().getPersistenceUnits().iterator().next();
}
protected ClassRef getSpecifiedClassRef() {
- return getPersistenceUnit().specifiedClassRefs().next();
+ return getPersistenceUnit().getSpecifiedClassRefs().iterator().next();
}
protected JavaPersistentType getJavaPersistentType() {
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaFileTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaFileTests.java
index 10cc74ec73..2b03132660 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaFileTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaFileTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -240,11 +240,11 @@ public class JpaFileTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaPersistentType javaPersistentType = getJavaPersistentType();
assertEquals(javaPersistentType, javaJpaFile.getRootStructureNodes().iterator().next());
- assertEquals(getEntityMappings().getPersistenceUnit().specifiedClassRefs().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
+ assertEquals(getEntityMappings().getPersistenceUnit().getSpecifiedClassRefs().iterator().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
getEntityMappings().getPersistenceUnit().removeSpecifiedClassRef(0);
assertNotSame(javaPersistentType, javaJpaFile.getRootStructureNodes().iterator().next());
- assertEquals(getEntityMappings().getPersistenceUnit().impliedClassRefs().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
+ assertEquals(getEntityMappings().getPersistenceUnit().getImpliedClassRefs().iterator().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
}
public void testJavaPersistentTypeRootStructureNodeRemovedFromResourceModel() throws Exception {
@@ -256,12 +256,12 @@ public class JpaFileTests extends ContextModelTestCase
Iterator<JpaStructureNode> rootStructureNodes = javaJpaFile.getRootStructureNodes().iterator();
JpaStructureNode rootStructureNode = rootStructureNodes.next();
assertEquals(javaPersistentType, rootStructureNode);
- assertEquals(getEntityMappings().getPersistenceUnit().specifiedClassRefs().next(), rootStructureNode.getParent());
+ assertEquals(getEntityMappings().getPersistenceUnit().getSpecifiedClassRefs().iterator().next(), rootStructureNode.getParent());
assertFalse(rootStructureNodes.hasNext());
removeXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
assertNotSame(javaPersistentType, javaJpaFile.getRootStructureNodes().iterator().next());
- assertEquals(getEntityMappings().getPersistenceUnit().impliedClassRefs().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
+ assertEquals(getEntityMappings().getPersistenceUnit().getImpliedClassRefs().iterator().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
}
public void testImpliedJavaPersistentTypeRootStructureNodeRemoved() throws Exception {
@@ -269,7 +269,7 @@ public class JpaFileTests extends ContextModelTestCase
ICompilationUnit cu = createTestEntity();
JpaFile javaJpaFile = JptJpaCorePlugin.getJpaFile((IFile) cu.getResource());
- JavaPersistentType javaPersistentType = getPersistenceUnit().impliedClassRefs().next().getJavaPersistentType();
+ JavaPersistentType javaPersistentType = getPersistenceUnit().getImpliedClassRefs().iterator().next().getJavaPersistentType();
assertEquals(javaPersistentType, javaJpaFile.getRootStructureNodes().iterator().next());
javaPersistentType.setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
@@ -289,7 +289,7 @@ public class JpaFileTests extends ContextModelTestCase
getOrmXmlResource().getContents().remove(getXmlEntityMappings());
assertNotSame(javaPersistentType, javaJpaFile.getRootStructureNodes().iterator().next());
assertEquals(1, javaJpaFile.getRootStructureNodesSize());
- assertEquals(getPersistenceUnit().impliedClassRefs().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
+ assertEquals(getPersistenceUnit().getImpliedClassRefs().iterator().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
}
public void testJavaRootStructureNodesPersistenceUnitRemovedFromResourceModel() throws Exception {
@@ -334,7 +334,7 @@ public class JpaFileTests extends ContextModelTestCase
getEntityMappings().removePersistentType(0);
assertNotSame(javaPersistentType, javaJpaFile.getRootStructureNodes().iterator().next());
assertEquals(1, javaJpaFile.getRootStructureNodesSize());
- assertEquals(getEntityMappings().getPersistenceUnit().impliedClassRefs().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
+ assertEquals(getEntityMappings().getPersistenceUnit().getImpliedClassRefs().iterator().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
}
public void testJavaRootStructureNodesOrmTypeMappingMorphed() throws Exception {
@@ -354,7 +354,7 @@ public class JpaFileTests extends ContextModelTestCase
getEntityMappings().removePersistentType(0);
assertNotSame(javaPersistentType, javaJpaFile.getRootStructureNodes().iterator().next());
assertEquals(1, javaJpaFile.getRootStructureNodesSize());
- assertEquals(getEntityMappings().getPersistenceUnit().impliedClassRefs().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
+ assertEquals(getEntityMappings().getPersistenceUnit().getImpliedClassRefs().iterator().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
}
public void testUpdateOrmJavaRootStructureNodeMappingFileRefChanged() throws Exception {
@@ -365,7 +365,7 @@ public class JpaFileTests extends ContextModelTestCase
assertEquals(ormPersistentType.getJavaPersistentType(), javaJpaFile.getRootStructureNodes().iterator().next());
- MappingFileRef mappingFileRef = getPersistenceUnit().mappingFileRefs().next();
+ MappingFileRef mappingFileRef = getPersistenceUnit().getMappingFileRefs().iterator().next();
mappingFileRef.setFileName("foo");
ormPersistentType = ((EntityMappings) getPersistenceUnit().getImpliedMappingFileRef().getMappingFile().getRoot()).getPersistentTypes().iterator().next();
@@ -385,7 +385,7 @@ public class JpaFileTests extends ContextModelTestCase
assertEquals(getJavaPersistentType(), javaJpaFile.getRootStructureNodes().iterator().next());
- MappingFileRef mappingFileRef = getPersistenceUnit().mappingFileRefs().next();
+ MappingFileRef mappingFileRef = getPersistenceUnit().getMappingFileRefs().iterator().next();
mappingFileRef.setFileName("foo");
assertEquals(getJavaPersistentType(), javaJpaFile.getRootStructureNodes().iterator().next());
}
@@ -405,7 +405,7 @@ public class JpaFileTests extends ContextModelTestCase
assertNotSame(javaPersistentType, javaJpaFile.getRootStructureNodes().iterator().next());
assertEquals(1, javaJpaFile.getRootStructureNodesSize());
- assertEquals(getPersistenceUnit().impliedClassRefs().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
+ assertEquals(getPersistenceUnit().getImpliedClassRefs().iterator().next(), javaJpaFile.getRootStructureNodes().iterator().next().getParent());
}
//TODO test rootStructureNodes with a static inner class
} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java
index 1a2395aba8..43bf4247d5 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -10,8 +10,12 @@
package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
-
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.MappingKeys;
@@ -20,12 +24,11 @@ import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping;
+import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@SuppressWarnings("nls")
@@ -77,7 +80,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertEquals("id", persistentAttribute.getName());
}
@@ -86,7 +89,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestEntityAnnotatedMethod();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertTrue(persistentAttribute.getMapping() instanceof JavaIdMapping);
persistentAttribute.setMappingKey(null);
@@ -97,7 +100,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestEntityAnnotatedMethod();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertTrue(persistentAttribute.getMapping() instanceof JavaIdMapping);
persistentAttribute.setMappingKey(null);
@@ -108,7 +111,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertTrue(persistentAttribute.getMapping().isDefault());
assertNotNull(persistentAttribute.getMapping());
@@ -118,7 +121,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestEntityAnnotatedMethod();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
@@ -130,7 +133,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestEntityAnnotatedMethod();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
@@ -140,14 +143,14 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertTrue(persistentAttribute.getMapping().isDefault());
persistentAttribute.setMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
-
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceAttribute resourceAttribute = resourceType.getFields().iterator().next();
+ assertNotNull(resourceAttribute.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
assertTrue(persistentAttribute.getMapping() instanceof JavaEmbeddedMapping);
@@ -157,14 +160,14 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestEntityAnnotatedField();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
persistentAttribute.setMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceAttribute resourceAttribute = resourceType.getFields().iterator().next();
+ assertNotNull(resourceAttribute.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
assertTrue(persistentAttribute.getMapping() instanceof JavaEmbeddedMapping);
@@ -174,14 +177,14 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestEntityAnnotatedMethod();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
persistentAttribute.setMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceAttribute resourceAttribute = resourceType.getFields().iterator().next();
+ assertNull(resourceAttribute.getAnnotation(IdAnnotation.ANNOTATION_NAME));
assertTrue(persistentAttribute.getMapping().isDefault());
}
@@ -190,12 +193,12 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestEntityAnnotatedField();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertEquals(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.setPrimaryAnnotation(EmbeddedAnnotation.ANNOTATION_NAME, EmptyIterable.<String>instance());
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceAttribute resourceAttribute = resourceType.getFields().iterator().next();
+ resourceAttribute.setPrimaryAnnotation(EmbeddedAnnotation.ANNOTATION_NAME, EmptyIterable.<String>instance());
this.getJpaProject().synchronizeContextModel();
assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMappingKey());
}
@@ -204,12 +207,12 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertTrue(persistentAttribute.getMapping().isDefault());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.setPrimaryAnnotation(BasicAnnotation.ANNOTATION_NAME, EmptyIterable.<String>instance());
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceAttribute resourceAttribute = resourceType.getFields().iterator().next();
+ resourceAttribute.setPrimaryAnnotation(BasicAnnotation.ANNOTATION_NAME, EmptyIterable.<String>instance());
assertEquals(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getMapping().getKey());
}
@@ -218,7 +221,7 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestEntityAnnotatedField();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertEquals(AccessType.FIELD, persistentAttribute.getAccess());
assertEquals(AccessType.FIELD, persistentAttribute.getDefaultAccess());
assertEquals(null, persistentAttribute.getSpecifiedAccess());
@@ -228,9 +231,83 @@ public class GenericJavaPersistentAttributeTests extends ContextModelTestCase
createTestEntityAnnotatedMethod();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertEquals(AccessType.PROPERTY, persistentAttribute.getAccess());
assertEquals(AccessType.PROPERTY, persistentAttribute.getDefaultAccess());
assertEquals(null, persistentAttribute.getSpecifiedAccess());
}
+
+ public void testNonResolvingField() throws Exception {
+ createTestEntityWithNonResolvingField();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+
+ JavaResourceField resourceField = getJavaPersistentType().getJavaResourceType().getFields().iterator().next();
+
+ JavaPersistentAttribute attribute = getJavaPersistentType().getAttributeNamed("foo");
+ assertTrue(attribute.isFor(resourceField));
+ }
+
+ public void testIsPersistableMethod2() throws Exception {
+ createTestEntityWithNonResolvingMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ Iterator<JavaResourceMethod> methods = getJavaPersistentType().getJavaResourceType().getMethods().iterator();
+
+ JavaResourceMethod resourceGetter = methods.next();
+ JavaResourceMethod resourceSetter = methods.next();
+ JavaPersistentAttribute attribute = getJavaPersistentType().getAttributeNamed("foo");
+
+ assertTrue(attribute.isFor(resourceGetter, resourceSetter));
+ }
+
+ private ICompilationUnit createTestEntityWithNonResolvingField() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("private Foo foo;").append(CR);
+ sb.append(CR);
+ }
+ });
+ }
+
+ private ICompilationUnit createTestEntityWithNonResolvingMethod() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("private Foo foo;").append(CR);
+ sb.append(CR);
+ sb.append(" @Id");
+ sb.append(CR);
+ sb.append(" public Foo getFoo() {").append(CR);
+ sb.append(" return this.foo;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" ");
+ sb.append(CR);
+ sb.append(" public void setFoo(Foo foo) {").append(CR);
+ sb.append(" this.foo = foo;").append(CR);
+ sb.append(" }").append(CR);
+ sb.append(CR);
+ sb.append(" ");
+ }
+ });
+ }
+
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
index 9f0e196434..1223b406b0 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -13,6 +13,8 @@ import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
@@ -25,10 +27,11 @@ import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
+import org.eclipse.jpt.jpa.core.internal.context.java.FieldAccessor;
+import org.eclipse.jpt.jpa.core.internal.context.java.PropertyAccessor;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -256,7 +259,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
ClassRef classRef = classRefs.next();
@@ -273,7 +276,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
ClassRef classRef = classRefs.next();
@@ -290,7 +293,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
ClassRef classRef = classRefs.next();
@@ -307,7 +310,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
ClassRef classRef = classRefs.next();
JavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
@@ -326,7 +329,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.FIELD);
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
ClassRef classRef = classRefs.next();
JavaPersistentType javaPersistentType = classRef.getJavaPersistentType();
@@ -441,7 +444,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
ClassRef classRef = classRefs.next();
JavaPersistentType rootJavaPersistentType = classRef.getJavaPersistentType();
@@ -460,7 +463,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
//as the superPersistentType because of impliedClassRefs and changes for bug 190317
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
JavaPersistentType javaPersistentType = classRefs.next().getJavaPersistentType();
assertNotNull(javaPersistentType.getSuperPersistentType());
@@ -475,7 +478,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
ClassRef classRef = classRefs.next();
JavaPersistentType rootJavaPersistentType = classRef.getJavaPersistentType();
@@ -494,7 +497,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
JavaPersistentType rootJavaPersistentType = classRefs.next().getJavaPersistentType();
JavaPersistentType childJavaPersistentType = classRefs.next().getJavaPersistentType();
@@ -512,7 +515,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild2");
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
JavaPersistentType childJavaPersistentType = classRefs.next().getJavaPersistentType();
JavaPersistentType rootJavaPersistentType = classRefs.next().getJavaPersistentType();
@@ -558,8 +561,8 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
getJavaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNotNull(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ assertNotNull(resourceType.getAnnotation(EntityAnnotation.ANNOTATION_NAME));
assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
}
@@ -572,8 +575,8 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
getJavaPersistentType().setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNotNull(typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ assertNotNull(resourceType.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME));
assertEquals(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
}
@@ -586,8 +589,8 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ assertNull(resourceType.getAnnotation(EntityAnnotation.ANNOTATION_NAME));
assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
}
@@ -598,7 +601,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
assertEquals(MappingKeys.ENTITY_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- JavaResourcePersistentType resourceType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
resourceType.setPrimaryAnnotation(EmbeddableAnnotation.ANNOTATION_NAME, EmptyIterable.<String>instance());
this.getJpaProject().synchronizeContextModel();
@@ -611,7 +614,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
assertEquals(MappingKeys.NULL_TYPE_MAPPING_KEY, getJavaPersistentType().getMappingKey());
- JavaResourcePersistentType resourceType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
resourceType.setPrimaryAnnotation(EntityAnnotation.ANNOTATION_NAME, EmptyIterable.<String>instance());
this.getJpaProject().synchronizeContextModel();
@@ -631,7 +634,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
public void testAttributes() throws Exception {
createTestEntityAnnotatedMethod();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Iterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
+ Iterator<JavaPersistentAttribute> attributes = getJavaPersistentType().getAttributes().iterator();
assertEquals("id", attributes.next().getName());
assertFalse(attributes.hasNext());
@@ -641,10 +644,17 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
createTestEntityAnnotatedFieldAndMethod();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Iterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
+ Iterator<JavaPersistentAttribute> attributes = getJavaPersistentType().getAttributes().iterator();
- assertEquals("id", attributes.next().getName());
- assertEquals("name", attributes.next().getName());
+ JavaPersistentAttribute attribute = attributes.next();
+ assertEquals("id", attribute.getName());
+ assertTrue(attribute.getAccessor() instanceof FieldAccessor);
+ attribute = attributes.next();
+ assertEquals("name", attribute.getName());
+ assertTrue(attribute.getAccessor() instanceof FieldAccessor);
+ attribute = attributes.next();
+ assertEquals("id", attribute.getName());
+ assertTrue(attribute.getAccessor() instanceof PropertyAccessor);
assertFalse(attributes.hasNext());
}
@@ -652,14 +662,14 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
createTestEntityAnnotatedMethod();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(1, getJavaPersistentType().attributesSize());
+ assertEquals(1, getJavaPersistentType().getAttributesSize());
}
public void testAttributesSize2() throws Exception {
createTestEntityAnnotatedFieldAndMethod();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(2, getJavaPersistentType().attributesSize());
+ assertEquals(3, getJavaPersistentType().getAttributesSize());
}
public void testAttributeNamed() throws Exception {
@@ -688,7 +698,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
ICompilationUnit testType = createTestEntityAnnotatedField();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Iterator<JavaPersistentAttribute> attributes = getJavaPersistentType().attributes();
+ Iterator<JavaPersistentAttribute> attributes = getJavaPersistentType().getAttributes().iterator();
JavaPersistentAttribute idAttribute = attributes.next();
JavaPersistentAttribute nameAttribute = attributes.next();
@@ -699,7 +709,7 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
IField idField = testType.findPrimaryType().getField("id");
idField.rename("id2", false, null);
- attributes = getJavaPersistentType().attributes();
+ attributes = getJavaPersistentType().getAttributes().iterator();
JavaPersistentAttribute nameAttribute2 = attributes.next();
JavaPersistentAttribute id2Attribute = attributes.next();
@@ -756,4 +766,135 @@ public class GenericJavaPersistentTypeTests extends ContextModelTestCase
};
this.javaProject.createCompilationUnit(PACKAGE_NAME, "Entity2.java", sourceWriter);
}
+
+
+ public void testGetAccessNoAttributesAnnotated() throws Exception {
+ createTestEntity();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentType javaPersistentType = getJavaPersistentType();
+
+ assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
+ assertEquals(AccessType.FIELD, javaPersistentType.getDefaultAccess());
+ assertNull(javaPersistentType.getSpecifiedAccess());
+ }
+
+ public void testGetAccessFieldsAnnotated() throws Exception {
+ createTestEntityAnnotatedField();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentType javaPersistentType = getJavaPersistentType();
+
+ assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
+ assertEquals(AccessType.FIELD, javaPersistentType.getDefaultAccess());
+ assertNull(javaPersistentType.getSpecifiedAccess());
+ }
+
+ public void testGetAccessMethodsAnnotated() throws Exception {
+ createTestEntityAnnotatedMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentType javaPersistentType = getJavaPersistentType();
+
+ assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
+ assertEquals(AccessType.PROPERTY, javaPersistentType.getDefaultAccess());
+ assertNull(javaPersistentType.getSpecifiedAccess());
+ }
+
+ public void testGetAccessFieldsAndMethodsAnnotated() throws Exception {
+ createTestEntityAnnotatedFieldAndMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentType javaPersistentType = getJavaPersistentType();
+
+ assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
+ assertEquals(AccessType.FIELD, javaPersistentType.getDefaultAccess());
+ assertNull(javaPersistentType.getSpecifiedAccess());
+ }
+
+ public void testGetAccessNonPersistableMethodAnnotated() throws Exception {
+ createTestEntityAnnotatedNonPersistableMethod();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentType javaPersistentType = getJavaPersistentType();
+
+ assertEquals(AccessType.PROPERTY, javaPersistentType.getAccess());
+ assertEquals(AccessType.PROPERTY, javaPersistentType.getDefaultAccess());
+ assertNull(javaPersistentType.getSpecifiedAccess());
+ }
+
+ public void testGetAccessPersistableMethodAndNonPersistableFieldAnnotated() throws Exception {
+ createTestEntityAnnotatedPersistableMethodNonPersistableField();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentType javaPersistentType = getJavaPersistentType();
+
+ assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
+ assertEquals(AccessType.FIELD, javaPersistentType.getDefaultAccess());
+ assertNull(javaPersistentType.getSpecifiedAccess());
+ }
+
+ public void testGetAccessNoPersistableFieldsAnnotated() throws Exception {
+ createTestEntityNoPersistableFields();
+ addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
+ JavaPersistentType javaPersistentType = getJavaPersistentType();
+
+ assertEquals(AccessType.FIELD, javaPersistentType.getAccess());
+ assertEquals(AccessType.FIELD, javaPersistentType.getDefaultAccess());
+ assertNull(javaPersistentType.getSpecifiedAccess());
+ }
+
+ private ICompilationUnit createTestEntityAnnotatedNonPersistableMethod() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.ID);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendGetNameMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Id");
+ }
+ });
+ }
+
+ private ICompilationUnit createTestEntityAnnotatedPersistableMethodNonPersistableField() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY, JPA.COLUMN);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+
+ @Override
+ public void appendIdFieldAnnotationTo(StringBuilder sb) {
+ sb.append("@Column");
+ sb.append(" private transient int notPersistable;").append(CR);
+ sb.append(CR);
+
+ }
+ @Override
+ public void appendGetIdMethodAnnotationTo(StringBuilder sb) {
+ sb.append("@Column");
+ }
+ });
+ }
+
+ private ICompilationUnit createTestEntityNoPersistableFields() throws Exception {
+ return this.createTestType(new DefaultAnnotationWriter() {
+ @Override
+ public Iterator<String> imports() {
+ return new ArrayIterator<String>(JPA.ENTITY);
+ }
+ @Override
+ public void appendTypeAnnotationTo(StringBuilder sb) {
+ sb.append("@Entity");
+ }
+ @Override
+ public void appendMemberTypeTo(StringBuilder sb) {
+ sb.delete(sb.indexOf("private int id;"), sb.indexOf("private int id;") + "private int id;".length());
+ sb.delete(sb.indexOf("private String name;"), sb.indexOf("private String name;") + "private String name;".length());
+ }
+ });
+ }
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaAssociationOverrideTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaAssociationOverrideTests.java
index dcec135aca..b5e0df8915 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaAssociationOverrideTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaAssociationOverrideTests.java
@@ -12,6 +12,8 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.context.AssociationOverride;
@@ -26,7 +28,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride;
import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@SuppressWarnings("nls")
@@ -103,15 +104,15 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
JavaEntity entity = getJavaEntity();
JavaAssociationOverrideContainer overrideContainer = entity.getAssociationOverrideContainer();
- VirtualAssociationOverride virtualOverride = overrideContainer.virtualOverrides().next();
+ VirtualAssociationOverride virtualOverride = overrideContainer.getVirtualOverrides().iterator().next();
AssociationOverride javaAssociationOverride = virtualOverride.convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(PACKAGE_NAME + ".AnnotationTestTypeChild", Kind.TYPE);
+ AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) resourceType.getAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
assertEquals("address", javaAssociationOverride.getName());
assertEquals("address", associationOverrideResource.getName());
- assertTrue(overrideContainer.overrides().hasNext());
+ assertTrue(overrideContainer.getOverrides().iterator().hasNext());
//set name in the resource model, verify context model updated
associationOverrideResource.setName("FOO");
@@ -122,20 +123,20 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
//set name to null in the resource model
associationOverrideResource.setName(null);
getJpaProject().synchronizeContextModel();
- assertEquals(0, overrideContainer.specifiedOverridesSize());
+ assertEquals(0, overrideContainer.getSpecifiedOverridesSize());
assertNull(associationOverrideResource.getName());
associationOverrideResource.setName("FOO");
getJpaProject().synchronizeContextModel();
- assertEquals(1, overrideContainer.specifiedOverridesSize());
- javaAssociationOverride = overrideContainer.specifiedOverrides().next();
+ assertEquals(1, overrideContainer.getSpecifiedOverridesSize());
+ javaAssociationOverride = overrideContainer.getSpecifiedOverrides().iterator().next();
assertEquals("FOO", javaAssociationOverride.getName());
assertEquals("FOO", associationOverrideResource.getName());
- typeResource.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ resourceType.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
getJpaProject().synchronizeContextModel();
- assertFalse(overrideContainer.specifiedOverrides().hasNext());
- assertFalse(typeResource.annotations(JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES).hasNext());
+ assertFalse(overrideContainer.getSpecifiedOverrides().iterator().hasNext());
+ assertFalse(resourceType.getAnnotations(JPA.ASSOCIATION_OVERRIDE).iterator().hasNext());
}
public void testModifyName() throws Exception {
@@ -146,15 +147,15 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
JavaEntity entity = getJavaEntity();
JavaAssociationOverrideContainer overrideContainer = entity.getAssociationOverrideContainer();
- VirtualAssociationOverride virtualAssociationOverride = overrideContainer.virtualOverrides().next();
+ VirtualAssociationOverride virtualAssociationOverride = overrideContainer.getVirtualOverrides().iterator().next();
AssociationOverride javaAssociationOverride = virtualAssociationOverride.convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(PACKAGE_NAME + ".AnnotationTestTypeChild", Kind.TYPE);
+ AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) resourceType.getAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
assertEquals("address", javaAssociationOverride.getName());
assertEquals("address", associationOverrideResource.getName());
- assertTrue(overrideContainer.overrides().hasNext());
+ assertTrue(overrideContainer.getOverrides().iterator().hasNext());
//set name in the context model, verify resource model modified
javaAssociationOverride.setName("foo");
@@ -164,7 +165,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
//set name to null in the context model
javaAssociationOverride.setName(null);
assertNull(javaAssociationOverride.getName());
- associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE);
+ associationOverrideResource = (AssociationOverrideAnnotation) resourceType.getAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
assertNull(associationOverrideResource.getName());
}
@@ -176,12 +177,12 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
JavaEntity entity = getJavaEntity();
JavaAssociationOverrideContainer overrideContainer = entity.getAssociationOverrideContainer();
- JavaVirtualAssociationOverride virtualOverride = overrideContainer.virtualOverrides().next();
+ JavaVirtualAssociationOverride virtualOverride = overrideContainer.getVirtualOverrides().iterator().next();
JavaAssociationOverride specifiedOverride = virtualOverride.convertToSpecified();
JavaJoinColumnRelationshipStrategy joiningStrategy = specifiedOverride.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AssociationOverrideAnnotation associationOverrideAnnotation = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(PACKAGE_NAME + ".AnnotationTestTypeChild", Kind.TYPE);
+ AssociationOverrideAnnotation associationOverrideAnnotation = (AssociationOverrideAnnotation) resourceType.getAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
JavaJoinColumn joinColumn1 = joiningStrategy.addSpecifiedJoinColumn(0);
@@ -198,19 +199,19 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
JavaJoinColumn joinColumn3 = joiningStrategy.addSpecifiedJoinColumn(1);
joinColumn3.setSpecifiedName("BAZ");
- assertEquals(4, associationOverrideAnnotation.joinColumnsSize());
+ assertEquals(4, associationOverrideAnnotation.getJoinColumnsSize());
assertEquals("BAR", associationOverrideAnnotation.joinColumnAt(0).getName());
assertEquals("BAZ", associationOverrideAnnotation.joinColumnAt(1).getName());
assertEquals("FOO", associationOverrideAnnotation.joinColumnAt(2).getName());
assertEquals("address_id", associationOverrideAnnotation.joinColumnAt(3).getName()); // the old default join column
- assertEquals(4, joiningStrategy.specifiedJoinColumnsSize());
- ListIterator<JavaJoinColumn> joinColumns = joiningStrategy.specifiedJoinColumns();
+ assertEquals(4, joiningStrategy.getSpecifiedJoinColumnsSize());
+ ListIterator<JavaJoinColumn> joinColumns = joiningStrategy.getSpecifiedJoinColumns().iterator();
assertEquals(joinColumn2, joinColumns.next());
assertEquals(joinColumn3, joinColumns.next());
assertEquals(joinColumn1, joinColumns.next());
- joinColumns = joiningStrategy.specifiedJoinColumns();
+ joinColumns = joiningStrategy.getSpecifiedJoinColumns().iterator();
assertEquals("BAR", joinColumns.next().getName());
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("FOO", joinColumns.next().getName());
@@ -225,35 +226,35 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
JavaEntity entity = getJavaEntity();
JavaAssociationOverrideContainer overrideContainer = entity.getAssociationOverrideContainer();
- JavaVirtualAssociationOverride javaAssociationOverride = overrideContainer.virtualOverrides().next();
+ JavaVirtualAssociationOverride javaAssociationOverride = overrideContainer.getVirtualOverrides().iterator().next();
JavaAssociationOverride specifiedOverride = javaAssociationOverride.convertToSpecified();
JavaJoinColumnRelationshipStrategy joiningStrategy = specifiedOverride.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(PACKAGE_NAME + ".AnnotationTestTypeChild", Kind.TYPE);
+ AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) resourceType.getAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
- assertEquals(1, associationOverrideResource.joinColumnsSize());
+ assertEquals(1, associationOverrideResource.getJoinColumnsSize());
joiningStrategy.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
joiningStrategy.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
joiningStrategy.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
- assertEquals(4, associationOverrideResource.joinColumnsSize());
+ assertEquals(4, associationOverrideResource.getJoinColumnsSize());
joiningStrategy.removeSpecifiedJoinColumn(0);
- assertEquals(3, associationOverrideResource.joinColumnsSize());
+ assertEquals(3, associationOverrideResource.getJoinColumnsSize());
assertEquals("BAR", associationOverrideResource.joinColumnAt(0).getName());
assertEquals("BAZ", associationOverrideResource.joinColumnAt(1).getName());
joiningStrategy.removeSpecifiedJoinColumn(0);
- assertEquals(2, associationOverrideResource.joinColumnsSize());
+ assertEquals(2, associationOverrideResource.getJoinColumnsSize());
assertEquals("BAZ", associationOverrideResource.joinColumnAt(0).getName());
joiningStrategy.removeSpecifiedJoinColumn(0);
- assertEquals(1, associationOverrideResource.joinColumnsSize());
+ assertEquals(1, associationOverrideResource.getJoinColumnsSize());
joiningStrategy.removeSpecifiedJoinColumn(0);
- assertEquals(0, associationOverrideResource.joinColumnsSize());
+ assertEquals(0, associationOverrideResource.getJoinColumnsSize());
}
public void testMoveSpecifiedJoinColumn() throws Exception {
@@ -264,22 +265,22 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
JavaEntity entity = getJavaEntity();
JavaAssociationOverrideContainer overrideContainer = entity.getAssociationOverrideContainer();
- JavaVirtualAssociationOverride javaAssociationOverride = overrideContainer.virtualOverrides().next();
+ JavaVirtualAssociationOverride javaAssociationOverride = overrideContainer.getVirtualOverrides().iterator().next();
JavaAssociationOverride specifiedOverride = javaAssociationOverride.convertToSpecified();
JavaJoinColumnRelationshipStrategy joiningStrategy = specifiedOverride.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(PACKAGE_NAME + ".AnnotationTestTypeChild", Kind.TYPE);
+ AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) resourceType.getAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
joiningStrategy.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
joiningStrategy.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
joiningStrategy.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
- assertEquals(4, associationOverrideResource.joinColumnsSize());
+ assertEquals(4, associationOverrideResource.getJoinColumnsSize());
joiningStrategy.moveSpecifiedJoinColumn(2, 0);
- ListIterator<JavaJoinColumn> joinColumns = joiningStrategy.specifiedJoinColumns();
+ ListIterator<JavaJoinColumn> joinColumns = joiningStrategy.getSpecifiedJoinColumns().iterator();
assertEquals("BAR", joinColumns.next().getName());
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("FOO", joinColumns.next().getName());
@@ -290,7 +291,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
joiningStrategy.moveSpecifiedJoinColumn(0, 1);
- joinColumns = joiningStrategy.specifiedJoinColumns();
+ joinColumns = joiningStrategy.getSpecifiedJoinColumns().iterator();
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("BAR", joinColumns.next().getName());
assertEquals("FOO", joinColumns.next().getName());
@@ -308,14 +309,14 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
JavaEntity entity = getJavaEntity();
JavaAssociationOverrideContainer overrideContainer = entity.getAssociationOverrideContainer();
- JavaVirtualAssociationOverride javaAssociationOverride = overrideContainer.virtualOverrides().next();
+ JavaVirtualAssociationOverride javaAssociationOverride = overrideContainer.getVirtualOverrides().iterator().next();
JavaAssociationOverride specifiedOverride = javaAssociationOverride.convertToSpecified();
JavaJoinColumnRelationshipStrategy joiningStrategy = specifiedOverride.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(PACKAGE_NAME + ".AnnotationTestTypeChild", Kind.TYPE);
+ AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) resourceType.getAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
- ListIterator<JavaJoinColumn> joinColumns = joiningStrategy.specifiedJoinColumns();
+ ListIterator<JavaJoinColumn> joinColumns = joiningStrategy.getSpecifiedJoinColumns().iterator();
JoinColumn joinColumn = joinColumns.next();
assertEquals("address_id", joinColumn.getSpecifiedName());
assertEquals("id", joinColumn.getSpecifiedReferencedColumnName());
@@ -330,7 +331,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
associationOverrideResource.joinColumnAt(2).setName("BAZ");
getJpaProject().synchronizeContextModel();
- joinColumns = joiningStrategy.specifiedJoinColumns();
+ joinColumns = joiningStrategy.getSpecifiedJoinColumns().iterator();
assertEquals("FOO", joinColumns.next().getName());
assertEquals("BAR", joinColumns.next().getName());
assertEquals("BAZ", joinColumns.next().getName());
@@ -339,7 +340,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
associationOverrideResource.moveJoinColumn(2, 0);
getJpaProject().synchronizeContextModel();
- joinColumns = joiningStrategy.specifiedJoinColumns();
+ joinColumns = joiningStrategy.getSpecifiedJoinColumns().iterator();
assertEquals("BAR", joinColumns.next().getName());
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("FOO", joinColumns.next().getName());
@@ -348,7 +349,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
associationOverrideResource.moveJoinColumn(0, 1);
getJpaProject().synchronizeContextModel();
- joinColumns = joiningStrategy.specifiedJoinColumns();
+ joinColumns = joiningStrategy.getSpecifiedJoinColumns().iterator();
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("BAR", joinColumns.next().getName());
assertEquals("FOO", joinColumns.next().getName());
@@ -357,7 +358,7 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
associationOverrideResource.removeJoinColumn(1);
getJpaProject().synchronizeContextModel();
- joinColumns = joiningStrategy.specifiedJoinColumns();
+ joinColumns = joiningStrategy.getSpecifiedJoinColumns().iterator();
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("FOO", joinColumns.next().getName());
assertEquals("address_id", joinColumns.next().getName());
@@ -365,19 +366,19 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
associationOverrideResource.removeJoinColumn(1);
getJpaProject().synchronizeContextModel();
- joinColumns = joiningStrategy.specifiedJoinColumns();
+ joinColumns = joiningStrategy.getSpecifiedJoinColumns().iterator();
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("address_id", joinColumns.next().getName());
assertFalse(joinColumns.hasNext());
associationOverrideResource.removeJoinColumn(0);
getJpaProject().synchronizeContextModel();
- joinColumns = joiningStrategy.specifiedJoinColumns();
+ joinColumns = joiningStrategy.getSpecifiedJoinColumns().iterator();
assertEquals("address_id", joinColumns.next().getName());
associationOverrideResource.removeJoinColumn(0);
getJpaProject().synchronizeContextModel();
- assertFalse(joiningStrategy.specifiedJoinColumns().hasNext());
+ assertFalse(joiningStrategy.getSpecifiedJoinColumns().iterator().hasNext());
}
public void testGetName() throws Exception {
@@ -385,16 +386,16 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaAssociationOverrideContainer overrideContainer = getJavaEntity().getAssociationOverrideContainer();
- AssociationOverride specifiedAssociationOverride = overrideContainer.specifiedOverrides().next();
+ AssociationOverride specifiedAssociationOverride = overrideContainer.getSpecifiedOverrides().iterator().next();
assertEquals(ASSOCIATION_OVERRIDE_NAME, specifiedAssociationOverride.getName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) resourceType.getAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
associationOverrideResource.setName("FOO");
getJpaProject().synchronizeContextModel();
- specifiedAssociationOverride = overrideContainer.specifiedOverrides().next();
+ specifiedAssociationOverride = overrideContainer.getSpecifiedOverrides().iterator().next();
assertEquals("FOO", specifiedAssociationOverride.getName());
}
@@ -403,13 +404,13 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaAssociationOverrideContainer overrideContainer = getJavaEntity().getAssociationOverrideContainer();
- AssociationOverride specifiedAssociationOverride = overrideContainer.specifiedOverrides().next();
+ AssociationOverride specifiedAssociationOverride = overrideContainer.getSpecifiedOverrides().iterator().next();
assertEquals(ASSOCIATION_OVERRIDE_NAME, specifiedAssociationOverride.getName());
specifiedAssociationOverride.setName("FOO");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) typeResource.getAnnotation(JPA.ASSOCIATION_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ AssociationOverrideAnnotation associationOverrideResource = (AssociationOverrideAnnotation) resourceType.getAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
assertEquals("FOO", associationOverrideResource.getName());
}
@@ -423,9 +424,9 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
JavaEntity entity = getJavaEntity();
JavaAssociationOverrideContainer overrideContainer = entity.getAssociationOverrideContainer();
assertEquals("AnnotationTestTypeChild", entity.getName());
- assertEquals(1, overrideContainer.virtualOverridesSize());
+ assertEquals(1, overrideContainer.getVirtualOverridesSize());
- ReadOnlyAssociationOverride associationOverride = overrideContainer.virtualOverrides().next();
+ ReadOnlyAssociationOverride associationOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("address", associationOverride.getName());
}
@@ -438,9 +439,9 @@ public class JavaAssociationOverrideTests extends ContextModelTestCase
JavaEntity entity = getJavaEntity();
JavaAssociationOverrideContainer overrideContainer = entity.getAssociationOverrideContainer();
assertEquals("AnnotationTestTypeChild", entity.getName());
- assertEquals(1, overrideContainer.virtualOverridesSize());
+ assertEquals(1, overrideContainer.getVirtualOverridesSize());
- ReadOnlyAssociationOverride associationOverride = overrideContainer.virtualOverrides().next();
+ ReadOnlyAssociationOverride associationOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertTrue(associationOverride.isVirtual());
}
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaAttributeOverrideTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaAttributeOverrideTests.java
index b1fea4810d..35bb9702ae 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaAttributeOverrideTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaAttributeOverrideTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,6 +11,8 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
@@ -26,7 +28,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride;
import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@SuppressWarnings("nls")
@@ -91,16 +92,16 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
AttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- AttributeOverride specifiedAttributeOverride = overrideContainer.specifiedOverrides().next();
+ AttributeOverride specifiedAttributeOverride = overrideContainer.getSpecifiedOverrides().iterator().next();
assertEquals(ATTRIBUTE_OVERRIDE_NAME, specifiedAttributeOverride.getName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) resourceType.getAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverrideResource.setName("FOO");
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverride = overrideContainer.specifiedOverrides().next();
+ specifiedAttributeOverride = overrideContainer.getSpecifiedOverrides().iterator().next();
assertEquals("FOO", specifiedAttributeOverride.getName());
}
@@ -109,13 +110,13 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
AttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- AttributeOverride specifiedAttributeOverride = overrideContainer.specifiedOverrides().next();
+ AttributeOverride specifiedAttributeOverride = overrideContainer.getSpecifiedOverrides().iterator().next();
assertEquals(ATTRIBUTE_OVERRIDE_NAME, specifiedAttributeOverride.getName());
specifiedAttributeOverride.setName("FOO");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) resourceType.getAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertEquals("FOO", attributeOverrideResource.getName());
}
@@ -125,19 +126,19 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
AttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- AttributeOverride specifiedAttributeOverride = overrideContainer.specifiedOverrides().next();
+ AttributeOverride specifiedAttributeOverride = overrideContainer.getSpecifiedOverrides().iterator().next();
Column column = specifiedAttributeOverride.getColumn();
assertEquals(ATTRIBUTE_OVERRIDE_COLUMN_NAME, column.getName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) resourceType.getAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
ColumnAnnotation columnResource = attributeOverrideResource.getColumn();
columnResource.setName("FOO");
getJpaProject().synchronizeContextModel();
- column = overrideContainer.specifiedOverrides().next().getColumn();
+ column = overrideContainer.getSpecifiedOverrides().iterator().next().getColumn();
assertEquals("FOO", column.getName());
}
@@ -146,20 +147,20 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
AttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- AttributeOverride specifiedAttributeOverride = overrideContainer.specifiedOverrides().next();
+ AttributeOverride specifiedAttributeOverride = overrideContainer.getSpecifiedOverrides().iterator().next();
Column column = specifiedAttributeOverride.getColumn();
assertEquals(ATTRIBUTE_OVERRIDE_COLUMN_NAME, column.getName());
column.setSpecifiedName("FOO");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) resourceType.getAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
ColumnAnnotation columnResource = attributeOverrideResource.getColumn();
assertEquals("FOO", columnResource.getName());
column.setSpecifiedName(null);
- attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE);
+ attributeOverrideResource = (AttributeOverrideAnnotation) resourceType.getAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertNull(attributeOverrideResource.getColumn());
assertNotNull(specifiedAttributeOverride.getColumn());
}
@@ -173,17 +174,17 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase
Entity entity = getJavaEntity();
AttributeOverrideContainer overrideContainer = entity.getAttributeOverrideContainer();
assertEquals("AnnotationTestTypeChild", entity.getName());
- assertEquals(2, overrideContainer.virtualOverridesSize());
+ assertEquals(2, overrideContainer.getVirtualOverridesSize());
- ReadOnlyAttributeOverride attributeOverride = overrideContainer.virtualOverrides().next();
+ ReadOnlyAttributeOverride attributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("id", attributeOverride.getColumn().getDefaultName());
- JavaPersistentType mappedSuperclass = CollectionTools.list(getPersistenceUnit().specifiedClassRefs()).get(1).getJavaPersistentType();
+ JavaPersistentType mappedSuperclass = CollectionTools.list(getPersistenceUnit().getSpecifiedClassRefs()).get(1).getJavaPersistentType();
BasicMapping basicMapping = (BasicMapping) mappedSuperclass.getAttributeNamed("id").getMapping();
basicMapping.getColumn().setSpecifiedName("FOO");
- attributeOverride = overrideContainer.virtualOverrides().next();
+ attributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("FOO", attributeOverride.getColumn().getDefaultName());
}
@@ -196,17 +197,17 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase
Entity entity = getJavaEntity();
AttributeOverrideContainer overrideContainer = entity.getAttributeOverrideContainer();
assertEquals("AnnotationTestTypeChild", entity.getName());
- assertEquals(2, overrideContainer.virtualOverridesSize());
+ assertEquals(2, overrideContainer.getVirtualOverridesSize());
- ReadOnlyAttributeOverride attributeOverride = overrideContainer.virtualOverrides().next();
+ ReadOnlyAttributeOverride attributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("AnnotationTestTypeChild", attributeOverride.getColumn().getDefaultTable());
- JavaPersistentType mappedSuperclass = CollectionTools.list(getPersistenceUnit().specifiedClassRefs()).get(1).getJavaPersistentType();
+ JavaPersistentType mappedSuperclass = CollectionTools.list(getPersistenceUnit().getSpecifiedClassRefs()).get(1).getJavaPersistentType();
BasicMapping basicMapping = (BasicMapping) mappedSuperclass.getAttributeNamed("id").getMapping();
basicMapping.getColumn().setSpecifiedTable("BAR");
- attributeOverride = overrideContainer.virtualOverrides().next();
+ attributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("BAR", attributeOverride.getColumn().getDefaultTable());
}
@@ -219,9 +220,9 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase
Entity entity = getJavaEntity();
AttributeOverrideContainer overrideContainer = entity.getAttributeOverrideContainer();
assertEquals("AnnotationTestTypeChild", entity.getName());
- assertEquals(2, overrideContainer.virtualOverridesSize());
+ assertEquals(2, overrideContainer.getVirtualOverridesSize());
- ReadOnlyAttributeOverride attributeOverride = overrideContainer.virtualOverrides().next();
+ ReadOnlyAttributeOverride attributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("id", attributeOverride.getName());
}
@@ -234,9 +235,9 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase
Entity entity = getJavaEntity();
AttributeOverrideContainer overrideContainer = entity.getAttributeOverrideContainer();
assertEquals("AnnotationTestTypeChild", entity.getName());
- assertEquals(2, overrideContainer.virtualOverridesSize());
+ assertEquals(2, overrideContainer.getVirtualOverridesSize());
- ReadOnlyAttributeOverride attributeOverride = overrideContainer.virtualOverrides().next();
+ ReadOnlyAttributeOverride attributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertTrue(attributeOverride.isVirtual());
}
@@ -247,14 +248,14 @@ public class JavaAttributeOverrideTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaAttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- JavaVirtualAttributeOverride attributeOverride = overrideContainer.virtualOverrides().next();
+ JavaVirtualAttributeOverride attributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
attributeOverride.convertToSpecified().getColumn().setSpecifiedName("FOO");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(PACKAGE_NAME + ".AnnotationTestTypeChild");
- AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) typeResource.getAnnotation(JPA.ATTRIBUTE_OVERRIDE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(PACKAGE_NAME + ".AnnotationTestTypeChild", Kind.TYPE);
+ AttributeOverrideAnnotation attributeOverrideResource = (AttributeOverrideAnnotation) resourceType.getAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertEquals("FOO", attributeOverrideResource.getColumn().getName());
- assertEquals("FOO", overrideContainer.specifiedOverrides().next().getColumn().getSpecifiedName());
+ assertEquals("FOO", overrideContainer.getSpecifiedOverrides().iterator().next().getColumn().getSpecifiedName());
}
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaBasicMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaBasicMappingTests.java
index b7dd1d28b7..103d128b80 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaBasicMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaBasicMappingTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,6 +11,10 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.JptJpaCorePlugin;
@@ -40,8 +44,6 @@ import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
@@ -166,7 +168,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertEquals(FetchType.EAGER, basicMapping.getDefaultFetch());
}
@@ -175,7 +177,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertEquals(FetchType.EAGER, basicMapping.getDefaultFetch());
}
@@ -184,7 +186,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertEquals(FetchType.EAGER, basicMapping.getFetch());
@@ -197,15 +199,15 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getSpecifiedFetch());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ BasicAnnotation basic = (BasicAnnotation) resourceField.getAnnotation(JPA.BASIC);
basic.setFetch(org.eclipse.jpt.jpa.core.resource.java.FetchType.LAZY);
getJpaProject().synchronizeContextModel();
@@ -216,7 +218,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMappingFetchOptionalSpecified();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertEquals(FetchType.EAGER, basicMapping.getSpecifiedFetch());
@@ -226,20 +228,20 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getSpecifiedFetch());
basicMapping.setSpecifiedFetch(FetchType.LAZY);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ BasicAnnotation basic = (BasicAnnotation) resourceField.getAnnotation(JPA.BASIC);
assertEquals(org.eclipse.jpt.jpa.core.resource.java.FetchType.LAZY, basic.getFetch());
basicMapping.setSpecifiedFetch(null);
- assertNotNull(attributeResource.getAnnotation(JPA.BASIC));
+ assertNotNull(resourceField.getAnnotation(JPA.BASIC));
}
public void testSetSpecifiedFetch2() throws Exception {
@@ -248,16 +250,16 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createOrmXmlFile();
getEntityMappings().getPersistenceUnitMetadata().getPersistenceUnitDefaults().setAccess(AccessType.PROPERTY);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getSpecifiedFetch());
assertTrue(basicMapping.isDefault());
basicMapping.setSpecifiedFetch(FetchType.LAZY);
- JavaResourcePersistentType resourceType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute resourceAttribute = resourceType.persistableProperties().next();
- BasicAnnotation basic = (BasicAnnotation) resourceAttribute.getAnnotation(JPA.BASIC);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceMethod resourceMethod = resourceType.getMethods().iterator().next();
+ BasicAnnotation basic = (BasicAnnotation) resourceMethod.getAnnotation(JPA.BASIC);
assertEquals(org.eclipse.jpt.jpa.core.resource.java.FetchType.LAZY, basic.getFetch());
@@ -266,7 +268,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
assertFalse(basicMapping.isDefault());
basicMapping.setSpecifiedFetch(null);
- assertNotNull(resourceAttribute.getAnnotation(JPA.BASIC));
+ assertNotNull(resourceMethod.getAnnotation(JPA.BASIC));
basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
@@ -283,17 +285,17 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
assertFalse(basicMapping.isDefault());
@@ -305,26 +307,26 @@ public class JavaBasicMappingTests extends ContextModelTestCase
assertTrue(basicMapping.isDefault());
assertEquals("FOO", basicMapping.getColumn().getSpecifiedName());
- assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
public void testBasicMorphToDefaultBasic() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
basicMapping.setConverter(EnumeratedConverter.class);
((EnumeratedConverter) basicMapping.getConverter()).setSpecifiedEnumType(EnumType.STRING);
- attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -335,27 +337,27 @@ public class JavaBasicMappingTests extends ContextModelTestCase
assertNull(((BasicMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
assertNull(((BasicMapping) persistentAttribute.getMapping()).getSpecifiedOptional());
- assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
public void testBasicMorphToId() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
basicMapping.setConverter(TemporalConverter.class);
((TemporalConverter) basicMapping.getConverter()).setTemporalType(TemporalType.TIME);
- attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -364,133 +366,133 @@ public class JavaBasicMappingTests extends ContextModelTestCase
assertEquals("FOO", ((IdMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
assertEquals(TemporalType.TIME, ((TemporalConverter) ((IdMapping) persistentAttribute.getMapping()).getConverter()).getTemporalType());
- assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
public void testBasicMorphToVersion() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
basicMapping.setConverter(TemporalConverter.class);
((TemporalConverter) basicMapping.getConverter()).setTemporalType(TemporalType.TIME);
- attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
assertFalse(basicMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
assertEquals("FOO", ((VersionMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
assertEquals(TemporalType.TIME, ((TemporalConverter) ((VersionMapping) persistentAttribute.getMapping()).getConverter()).getTemporalType());
- assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(VersionAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
public void testBasicMorphToEmbedded() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
assertFalse(basicMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
public void testBasicMorphToEmbeddedId() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
assertFalse(basicMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
public void testBasicMorphToTransient() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
assertFalse(basicMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
- assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(TransientAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
public void testBasicMorphToOneToOne() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -500,27 +502,27 @@ public class JavaBasicMappingTests extends ContextModelTestCase
//TODO assertEquals(FetchType.EAGER, ((IOneToOneMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
// assertEquals(Boolean.FALSE, ((IOneToOneMapping) persistentAttribute.getMapping()).getSpecifiedOptional());
- assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
public void testBasicMorphToOneToMany() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -529,26 +531,26 @@ public class JavaBasicMappingTests extends ContextModelTestCase
assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping);
//TODO assertEquals(FetchType.EAGER, ((IOneToManyMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
-// assertNotNull(attributeResource.mappingAnnotation(OneToMany.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+// assertNotNull(resourceField.mappingAnnotation(OneToMany.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
public void testBasicMorphToManyToOne() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -558,27 +560,27 @@ public class JavaBasicMappingTests extends ContextModelTestCase
//TODO assertEquals(FetchType.EAGER, ((IManyToOneMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
// assertEquals(Boolean.FALSE, ((IManyToOneMapping) persistentAttribute.getMapping()).getSpecifiedOptional());
- assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
public void testBasicMorphToManyToMany() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
assertFalse(basicMapping.isDefault());
basicMapping.getColumn().setSpecifiedName("FOO");
- attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
- attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
basicMapping.setSpecifiedFetch(FetchType.EAGER);
basicMapping.setSpecifiedOptional(Boolean.FALSE);
assertFalse(basicMapping.isDefault());
@@ -587,19 +589,19 @@ public class JavaBasicMappingTests extends ContextModelTestCase
assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping);
//TODO assertEquals(FetchType.EAGER, ((IManyToManyMapping) persistentAttribute.getMapping()).getSpecifiedFetch());
-// assertNotNull(attributeResource.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+// assertNotNull(resourceField.mappingAnnotation(ManyToMany.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
public void testDefaultBasicGetDefaultOptional() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertEquals(true, basicMapping.isDefaultOptional());
}
@@ -608,7 +610,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertEquals(true, basicMapping.isDefaultOptional());
}
@@ -617,7 +619,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertEquals(true, basicMapping.isOptional());
@@ -630,15 +632,15 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getSpecifiedOptional());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ BasicAnnotation basic = (BasicAnnotation) resourceField.getAnnotation(JPA.BASIC);
basic.setOptional(Boolean.FALSE);
getJpaProject().synchronizeContextModel();
@@ -649,7 +651,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMappingFetchOptionalSpecified();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertEquals(Boolean.FALSE, basicMapping.getSpecifiedOptional());
@@ -659,36 +661,36 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getSpecifiedOptional());
basicMapping.setSpecifiedOptional(Boolean.FALSE);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ BasicAnnotation basic = (BasicAnnotation) resourceField.getAnnotation(JPA.BASIC);
assertEquals(Boolean.FALSE, basic.getOptional());
basicMapping.setSpecifiedOptional(null);
- assertNotNull(attributeResource.getAnnotation(JPA.BASIC));
+ assertNotNull(resourceField.getAnnotation(JPA.BASIC));
}
public void testSetSpecifiedOptional2() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getSpecifiedOptional());
assertTrue(basicMapping.isDefault());
basicMapping.setSpecifiedOptional(Boolean.TRUE);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ BasicAnnotation basic = (BasicAnnotation) resourceField.getAnnotation(JPA.BASIC);
assertEquals(Boolean.TRUE, basic.getOptional());
@@ -697,7 +699,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
assertFalse(basicMapping.isDefault());
basicMapping.setSpecifiedOptional(null);
- assertNotNull(attributeResource.getAnnotation(JPA.BASIC));
+ assertNotNull(resourceField.getAnnotation(JPA.BASIC));
basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertFalse(basicMapping.isDefault());
@@ -708,15 +710,15 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getSpecifiedOptional());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- BasicAnnotation basic = (BasicAnnotation) attributeResource.getAnnotation(JPA.BASIC);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ BasicAnnotation basic = (BasicAnnotation) resourceField.getAnnotation(JPA.BASIC);
basic.setOptional(Boolean.FALSE);
getJpaProject().synchronizeContextModel();
@@ -729,7 +731,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
assertSame(basicMapping, persistentAttribute.getMapping());
basic.setOptional(Boolean.FALSE);
- attributeResource.setPrimaryAnnotation(null, EmptyIterable.<String>instance());
+ resourceField.setPrimaryAnnotation(null, EmptyIterable.<String>instance());
getJpaProject().synchronizeContextModel();
assertTrue(persistentAttribute.getMapping().isDefault());
@@ -741,7 +743,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertFalse(basicMapping.getConverter().getType() == LobConverter.class);
@@ -751,7 +753,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithLob();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertTrue(basicMapping.getConverter().getType() == LobConverter.class);
@@ -761,36 +763,36 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
basicMapping.setConverter(LobConverter.class);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNotNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNotNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
basicMapping.setConverter(null);
- assertNull(attributeResource.getAnnotation(LobAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(LobAnnotation.ANNOTATION_NAME));
}
public void testIsLobUpdatesFromResourceModelChange() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertFalse(basicMapping.getConverter().getType() == LobConverter.class);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(LobAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(LobAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
assertTrue(basicMapping.getConverter().getType() == LobConverter.class);
- attributeResource.removeAnnotation(LobAnnotation.ANNOTATION_NAME);
+ resourceField.removeAnnotation(LobAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
assertFalse(basicMapping.getConverter().getType() == LobConverter.class);
@@ -800,7 +802,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getConverter().getType());
}
@@ -809,7 +811,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getConverter().getType());
}
@@ -818,14 +820,14 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getConverter().getType());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- EnumeratedAnnotation enumeratedAnnotation = (EnumeratedAnnotation) attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ EnumeratedAnnotation enumeratedAnnotation = (EnumeratedAnnotation) resourceField.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
assertEquals(EnumType.ORDINAL, ((EnumeratedConverter) basicMapping.getConverter()).getDefaultEnumType());
@@ -838,7 +840,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithEnumerated();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertEquals(EnumType.STRING, ((EnumeratedConverter) basicMapping.getConverter()).getSpecifiedEnumType());
@@ -848,15 +850,15 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getConverter().getType());
basicMapping.setConverter(EnumeratedConverter.class);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ EnumeratedAnnotation enumerated = (EnumeratedAnnotation) resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
assertNotNull(enumerated);
assertEquals(null, enumerated.getValue());
@@ -865,26 +867,26 @@ public class JavaBasicMappingTests extends ContextModelTestCase
assertEquals(org.eclipse.jpt.jpa.core.resource.java.EnumType.STRING, enumerated.getValue());
((EnumeratedConverter) basicMapping.getConverter()).setSpecifiedEnumType(null);
- assertNotNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
assertNull(enumerated.getValue());
basicMapping.setConverter(null);
- assertNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
}
public void testGetSpecifiedEnumeratedUpdatesFromResourceModelChange() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getConverter().getType());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- EnumeratedAnnotation enumerated = (EnumeratedAnnotation) attributeResource.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ EnumeratedAnnotation enumerated = (EnumeratedAnnotation) resourceField.addAnnotation(EnumeratedAnnotation.ANNOTATION_NAME);
enumerated.setValue(org.eclipse.jpt.jpa.core.resource.java.EnumType.STRING);
getJpaProject().synchronizeContextModel();
@@ -892,7 +894,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
enumerated.setValue(null);
getJpaProject().synchronizeContextModel();
- assertNotNull(attributeResource.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(EnumeratedAnnotation.ANNOTATION_NAME));
assertNull(((EnumeratedConverter) basicMapping.getConverter()).getSpecifiedEnumType());
assertFalse(basicMapping.isDefault());
assertSame(basicMapping, persistentAttribute.getMapping());
@@ -902,12 +904,12 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertEquals(TemporalConverter.class, basicMapping.getConverter().getType());
@@ -917,7 +919,7 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithTemporal();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertEquals(TemporalConverter.class, basicMapping.getConverter().getType());
@@ -928,43 +930,43 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getConverter().getType());
basicMapping.setConverter(TemporalConverter.class);
((TemporalConverter) basicMapping.getConverter()).setTemporalType(TemporalType.TIME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ TemporalAnnotation temporal = (TemporalAnnotation) resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME);
assertEquals(org.eclipse.jpt.jpa.core.resource.java.TemporalType.TIME, temporal.getValue());
basicMapping.setConverter(null);
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
}
public void testGetTemporalUpdatesFromResourceModelChange() throws Exception {
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getConverter().getType());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ TemporalAnnotation temporal = (TemporalAnnotation) resourceField.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
temporal.setValue(org.eclipse.jpt.jpa.core.resource.java.TemporalType.DATE);
getJpaProject().synchronizeContextModel();
assertEquals(TemporalConverter.class, basicMapping.getConverter().getType());
assertEquals(TemporalType.DATE, ((TemporalConverter) basicMapping.getConverter()).getTemporalType());
- attributeResource.removeAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ resourceField.removeAnnotation(TemporalAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
assertNull(basicMapping.getConverter().getType());
@@ -976,15 +978,15 @@ public class JavaBasicMappingTests extends ContextModelTestCase
createTestEntityWithBasicMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
BasicMapping basicMapping = (BasicMapping) persistentAttribute.getMapping();
assertNull(basicMapping.getColumn().getSpecifiedName());
assertEquals("id", basicMapping.getColumn().getName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation column = (ColumnAnnotation) resourceField.addAnnotation(JPA.COLUMN);
column.setName("foo");
getJpaProject().synchronizeContextModel();
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaCascadeTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaCascadeTests.java
index 23634e6659..b2fe6086c3 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaCascadeTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaCascadeTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,13 +11,14 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.context.PersistentAttribute;
import org.eclipse.jpt.jpa.core.context.java.JavaCascade;
import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -53,11 +54,11 @@ public class JavaCascadeTests
createTestEntityWithOneToOneMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation annotation = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ OneToOneAnnotation annotation = (OneToOneAnnotation) resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
JavaOneToOneMapping mapping = (JavaOneToOneMapping) persistentAttribute.getMapping();
JavaCascade cascade = mapping.getCascade();
@@ -81,11 +82,11 @@ public class JavaCascadeTests
createTestEntityWithOneToOneMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation annotation = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ OneToOneAnnotation annotation = (OneToOneAnnotation) resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
JavaOneToOneMapping mapping = (JavaOneToOneMapping) persistentAttribute.getMapping();
JavaCascade cascade = mapping.getCascade();
@@ -107,11 +108,11 @@ public class JavaCascadeTests
createTestEntityWithOneToOneMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation annotation = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ OneToOneAnnotation annotation = (OneToOneAnnotation) resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
JavaOneToOneMapping mapping = (JavaOneToOneMapping) persistentAttribute.getMapping();
JavaCascade cascade = mapping.getCascade();
@@ -135,11 +136,11 @@ public class JavaCascadeTests
createTestEntityWithOneToOneMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation annotation = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ OneToOneAnnotation annotation = (OneToOneAnnotation) resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
JavaOneToOneMapping mapping = (JavaOneToOneMapping) persistentAttribute.getMapping();
JavaCascade cascade = mapping.getCascade();
@@ -161,11 +162,11 @@ public class JavaCascadeTests
createTestEntityWithOneToOneMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation annotation = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ OneToOneAnnotation annotation = (OneToOneAnnotation) resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
JavaOneToOneMapping mapping = (JavaOneToOneMapping) persistentAttribute.getMapping();
JavaCascade cascade = mapping.getCascade();
@@ -189,11 +190,11 @@ public class JavaCascadeTests
createTestEntityWithOneToOneMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation annotation = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ OneToOneAnnotation annotation = (OneToOneAnnotation) resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
JavaOneToOneMapping mapping = (JavaOneToOneMapping) persistentAttribute.getMapping();
JavaCascade cascade = mapping.getCascade();
@@ -215,11 +216,11 @@ public class JavaCascadeTests
createTestEntityWithOneToOneMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation annotation = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ OneToOneAnnotation annotation = (OneToOneAnnotation) resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
JavaOneToOneMapping mapping = (JavaOneToOneMapping) persistentAttribute.getMapping();
JavaCascade cascade = mapping.getCascade();
@@ -243,11 +244,11 @@ public class JavaCascadeTests
createTestEntityWithOneToOneMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation annotation = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ OneToOneAnnotation annotation = (OneToOneAnnotation) resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
JavaOneToOneMapping mapping = (JavaOneToOneMapping) persistentAttribute.getMapping();
JavaCascade cascade = mapping.getCascade();
@@ -269,11 +270,11 @@ public class JavaCascadeTests
createTestEntityWithOneToOneMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation annotation = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ OneToOneAnnotation annotation = (OneToOneAnnotation) resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
JavaOneToOneMapping mapping = (JavaOneToOneMapping) persistentAttribute.getMapping();
JavaCascade cascade = mapping.getCascade();
@@ -297,11 +298,11 @@ public class JavaCascadeTests
createTestEntityWithOneToOneMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- OneToOneAnnotation annotation = (OneToOneAnnotation) attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ OneToOneAnnotation annotation = (OneToOneAnnotation) resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
JavaOneToOneMapping mapping = (JavaOneToOneMapping) persistentAttribute.getMapping();
JavaCascade cascade = mapping.getCascade();
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaColumnTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaColumnTests.java
index d245552243..5df35938fb 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaColumnTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,6 +11,9 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
import org.eclipse.jpt.jpa.core.context.Entity;
@@ -18,8 +21,6 @@ import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn;
import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@SuppressWarnings("nls")
@@ -107,7 +108,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedName());
}
@@ -116,7 +117,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithDefaultBasicColumn();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(COLUMN_NAME, basicMapping.getColumn().getSpecifiedName());
}
@@ -124,7 +125,7 @@ public class JavaColumnTests extends ContextModelTestCase
public void testGetDefaultNameSpecifiedNameNull() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(basicMapping.getPersistentAttribute().getName(), basicMapping.getColumn().getDefaultName());
assertEquals("id", basicMapping.getColumn().getDefaultName());
@@ -134,7 +135,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithDefaultBasicColumn();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals("id", basicMapping.getColumn().getDefaultName());
basicMapping.getColumn().setSpecifiedName("foo");
@@ -144,7 +145,7 @@ public class JavaColumnTests extends ContextModelTestCase
public void testGetNameSpecifiedNameNull() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals("id", basicMapping.getColumn().getName());
}
@@ -152,7 +153,7 @@ public class JavaColumnTests extends ContextModelTestCase
public void testGetName() throws Exception {
createTestEntityWithDefaultBasicColumn();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(COLUMN_NAME, basicMapping.getColumn().getName());
}
@@ -160,15 +161,15 @@ public class JavaColumnTests extends ContextModelTestCase
public void testSetSpecifiedName() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
basicMapping.getColumn().setSpecifiedName("foo");
assertEquals("foo", basicMapping.getColumn().getSpecifiedName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation column = (ColumnAnnotation) resourceField.getAnnotation(JPA.COLUMN);
assertEquals("foo", column.getName());
}
@@ -177,27 +178,27 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithDefaultBasicColumn();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
basicMapping.getColumn().setSpecifiedName(null);
assertNull(basicMapping.getColumn().getSpecifiedName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(JPA.COLUMN));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(JPA.COLUMN));
}
public void testGetNameUpdatesFromResourceChange() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.addAnnotation(JPA.COLUMN);
columnAnnotation.setName("foo");
getJpaProject().synchronizeContextModel();
@@ -225,7 +226,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedTable());
}
@@ -234,7 +235,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnTableSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(TABLE_NAME, basicMapping.getColumn().getSpecifiedTable());
}
@@ -242,7 +243,7 @@ public class JavaColumnTests extends ContextModelTestCase
public void testGetDefaultTableSpecifiedTableNull() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(((Entity) basicMapping.getTypeMapping()).getName(), basicMapping.getColumn().getDefaultTable());
assertEquals(TYPE_NAME, basicMapping.getColumn().getDefaultTable());
@@ -252,7 +253,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithDefaultBasicColumn();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(TYPE_NAME, basicMapping.getColumn().getDefaultTable());
basicMapping.getColumn().setSpecifiedTable("foo");
@@ -262,7 +263,7 @@ public class JavaColumnTests extends ContextModelTestCase
public void testGetTable() throws Exception {
createTestEntityWithBasicColumnTableSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(TABLE_NAME, basicMapping.getColumn().getTable());
}
@@ -270,15 +271,15 @@ public class JavaColumnTests extends ContextModelTestCase
public void testSetSpecifiedTable() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
basicMapping.getColumn().setSpecifiedTable("foo");
assertEquals("foo", basicMapping.getColumn().getSpecifiedTable());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation column = (ColumnAnnotation) resourceField.getAnnotation(JPA.COLUMN);
assertEquals("foo", column.getTable());
}
@@ -287,27 +288,27 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnTableSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
basicMapping.getColumn().setSpecifiedTable(null);
assertNull(basicMapping.getColumn().getSpecifiedTable());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(JPA.COLUMN));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(JPA.COLUMN));
}
public void testGetTableUpdatesFromResourceChange() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedTable());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation column = (ColumnAnnotation) resourceField.addAnnotation(JPA.COLUMN);
column.setTable("foo");
getJpaProject().synchronizeContextModel();
@@ -322,7 +323,7 @@ public class JavaColumnTests extends ContextModelTestCase
public void testGetColumnDefinition() throws Exception {
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(COLUMN_DEFINITION, basicMapping.getColumn().getColumnDefinition());
}
@@ -330,13 +331,13 @@ public class JavaColumnTests extends ContextModelTestCase
public void testSetColumnDefinition() throws Exception {
createTestEntityWithBasicColumnTableSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
basicMapping.getColumn().setColumnDefinition("foo");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation column = (ColumnAnnotation) resourceField.getAnnotation(JPA.COLUMN);
assertEquals("foo", column.getColumnDefinition());
@@ -347,13 +348,13 @@ public class JavaColumnTests extends ContextModelTestCase
public void testGetColumnDefinitionUpdatesFromResourceChange() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getColumnDefinition());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation column = (ColumnAnnotation) resourceField.addAnnotation(JPA.COLUMN);
column.setColumnDefinition("foo");
getJpaProject().synchronizeContextModel();
@@ -368,7 +369,7 @@ public class JavaColumnTests extends ContextModelTestCase
public void testGetLength() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyColumn.DEFAULT_LENGTH, basicMapping.getColumn().getLength());
basicMapping.getColumn().setSpecifiedLength(Integer.valueOf(55));
@@ -379,7 +380,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyColumn.DEFAULT_LENGTH, basicMapping.getColumn().getDefaultLength());
basicMapping.getColumn().setSpecifiedLength(Integer.valueOf(55));
@@ -391,13 +392,13 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedLength());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.addAnnotation(JPA.COLUMN);
columnAnnotation.setLength(Integer.valueOf(66));
getJpaProject().synchronizeContextModel();
@@ -414,15 +415,15 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedLength());
basicMapping.getColumn().setSpecifiedLength(Integer.valueOf(100));
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.getAnnotation(JPA.COLUMN);
assertEquals(Integer.valueOf(100), columnAnnotation.getLength());
@@ -430,13 +431,13 @@ public class JavaColumnTests extends ContextModelTestCase
basicMapping.getColumn().setSpecifiedLength(null);
assertNull(columnAnnotation.getLength());
- assertNull(attributeResource.getAnnotation(JPA.COLUMN));
+ assertNull(resourceField.getAnnotation(JPA.COLUMN));
}
public void testGetPrecision() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyColumn.DEFAULT_PRECISION, basicMapping.getColumn().getPrecision());
basicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(55));
@@ -447,7 +448,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyColumn.DEFAULT_PRECISION, basicMapping.getColumn().getDefaultPrecision());
basicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(55));
@@ -459,13 +460,13 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedPrecision());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.addAnnotation(JPA.COLUMN);
columnAnnotation.setPrecision(Integer.valueOf(66));
getJpaProject().synchronizeContextModel();
@@ -482,15 +483,15 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedPrecision());
basicMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(100));
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.getAnnotation(JPA.COLUMN);
assertEquals(Integer.valueOf(100), columnAnnotation.getPrecision());
@@ -498,13 +499,13 @@ public class JavaColumnTests extends ContextModelTestCase
basicMapping.getColumn().setSpecifiedPrecision(null);
assertNull(columnAnnotation.getPrecision());
- assertNull(attributeResource.getAnnotation(JPA.COLUMN));
+ assertNull(resourceField.getAnnotation(JPA.COLUMN));
}
public void testGetScale() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyColumn.DEFAULT_SCALE, basicMapping.getColumn().getScale());
basicMapping.getColumn().setSpecifiedScale(Integer.valueOf(55));
@@ -515,7 +516,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyColumn.DEFAULT_SCALE, basicMapping.getColumn().getDefaultScale());
basicMapping.getColumn().setSpecifiedScale(Integer.valueOf(55));
@@ -527,13 +528,13 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedScale());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.addAnnotation(JPA.COLUMN);
columnAnnotation.setScale(Integer.valueOf(66));
getJpaProject().synchronizeContextModel();
@@ -550,15 +551,15 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedScale());
basicMapping.getColumn().setSpecifiedScale(Integer.valueOf(100));
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.getAnnotation(JPA.COLUMN);
assertEquals(Integer.valueOf(100), columnAnnotation.getScale());
@@ -566,13 +567,13 @@ public class JavaColumnTests extends ContextModelTestCase
basicMapping.getColumn().setSpecifiedScale(null);
assertNull(columnAnnotation.getScale());
- assertNull(attributeResource.getAnnotation(JPA.COLUMN));
+ assertNull(resourceField.getAnnotation(JPA.COLUMN));
}
public void testGetUnique() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyBaseColumn.DEFAULT_UNIQUE, basicMapping.getColumn().isUnique());
basicMapping.getColumn().setSpecifiedUnique(Boolean.TRUE);
@@ -583,7 +584,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyBaseColumn.DEFAULT_UNIQUE, basicMapping.getColumn().isDefaultUnique());
basicMapping.getColumn().setSpecifiedUnique(Boolean.TRUE);
@@ -595,13 +596,13 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedUnique());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.addAnnotation(JPA.COLUMN);
columnAnnotation.setUnique(Boolean.TRUE);
getJpaProject().synchronizeContextModel();
@@ -618,15 +619,15 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedUnique());
basicMapping.getColumn().setSpecifiedUnique(Boolean.FALSE);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.getAnnotation(JPA.COLUMN);
assertEquals(Boolean.FALSE, columnAnnotation.getUnique());
@@ -634,13 +635,13 @@ public class JavaColumnTests extends ContextModelTestCase
basicMapping.getColumn().setSpecifiedUnique(null);
assertNull(columnAnnotation.getUnique());
- assertNull(attributeResource.getAnnotation(JPA.COLUMN));
+ assertNull(resourceField.getAnnotation(JPA.COLUMN));
}
public void testGetInsertable() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyBaseColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().isInsertable());
basicMapping.getColumn().setSpecifiedInsertable(Boolean.TRUE);
@@ -651,7 +652,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyBaseColumn.DEFAULT_INSERTABLE, basicMapping.getColumn().isDefaultInsertable());
basicMapping.getColumn().setSpecifiedInsertable(Boolean.TRUE);
@@ -663,13 +664,13 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedInsertable());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.addAnnotation(JPA.COLUMN);
columnAnnotation.setInsertable(Boolean.TRUE);
getJpaProject().synchronizeContextModel();
@@ -686,15 +687,15 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedInsertable());
basicMapping.getColumn().setSpecifiedInsertable(Boolean.FALSE);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.getAnnotation(JPA.COLUMN);
assertEquals(Boolean.FALSE, columnAnnotation.getInsertable());
@@ -702,13 +703,13 @@ public class JavaColumnTests extends ContextModelTestCase
basicMapping.getColumn().setSpecifiedInsertable(null);
assertNull(columnAnnotation.getInsertable());
- assertNull(attributeResource.getAnnotation(JPA.COLUMN));
+ assertNull(resourceField.getAnnotation(JPA.COLUMN));
}
public void testGetNullable() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyBaseColumn.DEFAULT_NULLABLE, basicMapping.getColumn().isNullable());
basicMapping.getColumn().setSpecifiedNullable(Boolean.TRUE);
@@ -719,7 +720,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyBaseColumn.DEFAULT_NULLABLE, basicMapping.getColumn().isDefaultNullable());
basicMapping.getColumn().setSpecifiedNullable(Boolean.TRUE);
@@ -731,13 +732,13 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedNullable());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.addAnnotation(JPA.COLUMN);
columnAnnotation.setNullable(Boolean.TRUE);
getJpaProject().synchronizeContextModel();
@@ -754,15 +755,15 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedNullable());
basicMapping.getColumn().setSpecifiedNullable(Boolean.FALSE);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.getAnnotation(JPA.COLUMN);
assertEquals(Boolean.FALSE, columnAnnotation.getNullable());
@@ -770,13 +771,13 @@ public class JavaColumnTests extends ContextModelTestCase
basicMapping.getColumn().setSpecifiedNullable(null);
assertNull(columnAnnotation.getNullable());
- assertNull(attributeResource.getAnnotation(JPA.COLUMN));
+ assertNull(resourceField.getAnnotation(JPA.COLUMN));
}
public void testGetUpdatable() throws Exception {
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyBaseColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().isUpdatable());
basicMapping.getColumn().setSpecifiedUpdatable(Boolean.TRUE);
@@ -787,7 +788,7 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertEquals(ReadOnlyBaseColumn.DEFAULT_UPDATABLE, basicMapping.getColumn().isDefaultUpdatable());
basicMapping.getColumn().setSpecifiedUpdatable(Boolean.TRUE);
@@ -799,13 +800,13 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedUpdatable());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.addAnnotation(JPA.COLUMN);
columnAnnotation.setUpdatable(Boolean.TRUE);
getJpaProject().synchronizeContextModel();
@@ -822,15 +823,15 @@ public class JavaColumnTests extends ContextModelTestCase
createTestEntityWithBasicColumnColumnDefinitionSet();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().attributes().next().getMapping();
+ BasicMapping basicMapping = (BasicMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
assertNull(basicMapping.getColumn().getSpecifiedUpdatable());
basicMapping.getColumn().setSpecifiedUpdatable(Boolean.FALSE);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation columnAnnotation = (ColumnAnnotation) attributeResource.getAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation columnAnnotation = (ColumnAnnotation) resourceField.getAnnotation(JPA.COLUMN);
assertEquals(Boolean.FALSE, columnAnnotation.getUpdatable());
@@ -838,6 +839,6 @@ public class JavaColumnTests extends ContextModelTestCase
basicMapping.getColumn().setSpecifiedUpdatable(null);
assertNull(columnAnnotation.getUpdatable());
- assertNull(attributeResource.getAnnotation(JPA.COLUMN));
+ assertNull(resourceField.getAnnotation(JPA.COLUMN));
}
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java
index e37119eb0d..d9dacae611 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,6 +12,8 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn;
@@ -21,7 +23,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaEntity;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@SuppressWarnings("nls")
@@ -163,8 +164,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase
assertEquals("foo", getJavaEntity().getDiscriminatorColumn().getSpecifiedName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) resourceType.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
assertEquals("foo", discriminatorColumn.getName());
}
@@ -177,8 +178,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase
assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) resourceType.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
assertNull(discriminatorColumn);
}
@@ -216,8 +217,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase
assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) resourceType.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
discriminatorColumn.setDiscriminatorType(org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType.CHAR);
getJpaProject().synchronizeContextModel();
@@ -232,14 +233,14 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase
getJavaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(DiscriminatorType.CHAR);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) resourceType.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
assertEquals(org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType.CHAR, discriminatorColumn.getDiscriminatorType());
getJavaEntity().getDiscriminatorColumn().setSpecifiedName(null);
getJavaEntity().getDiscriminatorColumn().setSpecifiedDiscriminatorType(null);
- assertNull(typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN));
+ assertNull(resourceType.getAnnotation(JPA.DISCRIMINATOR_COLUMN));
}
public void testGetDiscriminatorTypeUpdatesFromResourceChange() throws Exception {
@@ -248,8 +249,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase
assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedDiscriminatorType());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) resourceType.addAnnotation(JPA.DISCRIMINATOR_COLUMN);
column.setDiscriminatorType(org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType.INTEGER);
getJpaProject().synchronizeContextModel();
@@ -301,8 +302,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase
assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedLength());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) resourceType.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
discriminatorColumn.setLength(Integer.valueOf(66));
getJpaProject().synchronizeContextModel();
@@ -323,14 +324,14 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase
getJavaEntity().getDiscriminatorColumn().setSpecifiedLength(Integer.valueOf(100));
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorColumnAnnotation discriminatorColumn = (DiscriminatorColumnAnnotation) resourceType.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
assertEquals(Integer.valueOf(100), discriminatorColumn.getLength());
getJavaEntity().getDiscriminatorColumn().setSpecifiedName(null);
getJavaEntity().getDiscriminatorColumn().setSpecifiedLength(null);
- assertNull(typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN));
+ assertNull(resourceType.getAnnotation(JPA.DISCRIMINATOR_COLUMN));
}
public void testGetLengthUpdatesFromResourceChange() throws Exception {
@@ -339,8 +340,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase
assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedLength());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) resourceType.addAnnotation(JPA.DISCRIMINATOR_COLUMN);
column.setLength(Integer.valueOf(78));
getJpaProject().synchronizeContextModel();
@@ -364,8 +365,8 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase
assertNull(getJavaEntity().getDiscriminatorColumn().getColumnDefinition());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) resourceType.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
column.setColumnDefinition(COLUMN_DEFINITION);
getJpaProject().synchronizeContextModel();
@@ -376,7 +377,7 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase
assertNull(getJavaEntity().getDiscriminatorColumn().getColumnDefinition());
- typeResource.removeAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ resourceType.removeAnnotation(JPA.DISCRIMINATOR_COLUMN);
}
public void testSetColumnDefinition() throws Exception {
@@ -385,13 +386,13 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase
getJavaEntity().getDiscriminatorColumn().setColumnDefinition("foo");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) resourceType.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
assertEquals("foo", column.getColumnDefinition());
getJavaEntity().getDiscriminatorColumn().setColumnDefinition(null);
- column = (DiscriminatorColumnAnnotation) typeResource.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ column = (DiscriminatorColumnAnnotation) resourceType.getAnnotation(JPA.DISCRIMINATOR_COLUMN);
assertNull(column.getColumnDefinition());
}
@@ -401,7 +402,7 @@ public class JavaDiscriminatorColumnTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + "." + "AnnotationTestTypeChild");
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
JavaEntity abstractEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
JavaEntity childEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddableTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddableTests.java
index 1d97e61490..766d9f9793 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddableTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddableTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.Embeddable;
@@ -19,7 +20,6 @@ import org.eclipse.jpt.jpa.core.context.MappedSuperclass;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaNullTypeMapping;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@SuppressWarnings("nls")
@@ -51,8 +51,8 @@ public class JavaEmbeddableTests extends ContextModelTestCase
getJavaPersistentType().setMappingKey(MappingKeys.ENTITY_TYPE_MAPPING_KEY);
assertTrue(getJavaPersistentType().getMapping() instanceof Entity);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME));
+ JavaResourceAbstractType resourceType = getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME);
+ assertNull(resourceType.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME));
}
public void testMorphToMappedSuperclass() throws Exception {
@@ -62,8 +62,8 @@ public class JavaEmbeddableTests extends ContextModelTestCase
getJavaPersistentType().setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
assertTrue(getJavaPersistentType().getMapping() instanceof MappedSuperclass);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME));
+ JavaResourceAbstractType resourceType = getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME);
+ assertNull(resourceType.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME));
}
public void testMorphToNull() throws Exception {
@@ -73,8 +73,8 @@ public class JavaEmbeddableTests extends ContextModelTestCase
getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
assertTrue(getJavaPersistentType().getMapping() instanceof JavaNullTypeMapping);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- assertNull(typeResource.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME));
+ JavaResourceAbstractType resourceType = getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME);
+ assertNull(resourceType.getAnnotation(EmbeddableAnnotation.ANNOTATION_NAME));
}
public void testEmbeddable() throws Exception {
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java
index 07dde40292..7ce0b398e8 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,6 +12,10 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.MappingKeys;
@@ -37,17 +41,13 @@ import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNullAttributeMapping;
import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
@@ -115,20 +115,20 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedIdMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof BasicMapping);
assertFalse(persistentAttribute.getMapping().isDefault());
- assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToDefault() throws Exception {
@@ -137,26 +137,26 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedIdMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertTrue(((JavaEmbeddedMapping) persistentAttribute.getMapping()).getAttributeOverrideContainer().overrides().hasNext());
+ assertTrue(((JavaEmbeddedMapping) persistentAttribute.getMapping()).getAttributeOverrideContainer().getOverrides().iterator().hasNext());
assertTrue(persistentAttribute.getMapping().isDefault());
- assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testDefaultEmbeddedIdMapping() throws Exception {
createTestEntityWithEmbeddedIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
assertFalse(embeddedIdMapping.isDefault());
@@ -175,19 +175,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedIdMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof VersionMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(VersionAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToTransientMapping() throws Exception {
@@ -195,19 +195,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedIdMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(TransientAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToIdMapping() throws Exception {
@@ -215,19 +215,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedIdMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof IdMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToEmbeddedMapping() throws Exception {
@@ -235,19 +235,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedIdMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToOneToOneMapping() throws Exception {
@@ -255,19 +255,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedIdMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToOneToManyMapping() throws Exception {
@@ -275,19 +275,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedIdMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToManyToOneMapping() throws Exception {
@@ -295,19 +295,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedIdMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToManyToManyMapping() throws Exception {
@@ -315,19 +315,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedIdMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testSpecifiedAttributeOverrides() throws Exception {
@@ -338,65 +338,65 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
JavaEmbeddedIdMapping embeddedIdMapping = (JavaEmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
JavaAttributeOverrideContainer attributeOverrideContainer = embeddedIdMapping.getAttributeOverrideContainer();
- ListIterator<JavaAttributeOverride> specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ ListIterator<JavaAttributeOverride> specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertFalse(specifiedAttributeOverrides.hasNext());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
//add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("FOO");
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("BAR");
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", specifiedAttributeOverrides.next().getName());
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("BAZ");
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
assertEquals("FOO", specifiedAttributeOverrides.next().getName());
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
//move an annotation to the resource model and verify the context model is updated
- attributeResource.moveAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES);
+ resourceField.moveAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", specifiedAttributeOverrides.next().getName());
assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ resourceField.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ resourceField.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ resourceField.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertFalse(specifiedAttributeOverrides.hasNext());
}
@@ -409,14 +409,13 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
JavaEmbeddedIdMapping embeddedMapping = (JavaEmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
JavaAttributeOverrideContainer attributeOverrideContainer = embeddedMapping.getAttributeOverrideContainer();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertEquals("myEmbeddedId", attributeResource.getName());
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
-
- assertEquals(2, attributeOverrideContainer.virtualOverridesSize());
- ReadOnlyAttributeOverride defaultAttributeOverride = attributeOverrideContainer.virtualOverrides().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertEquals("myEmbeddedId", resourceField.getName());
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
+
+ assertEquals(2, attributeOverrideContainer.getVirtualOverridesSize());
+ ReadOnlyAttributeOverride defaultAttributeOverride = attributeOverrideContainer.getVirtualOverrides().iterator().next();
assertEquals("city", defaultAttributeOverride.getName());
assertEquals("city", defaultAttributeOverride.getColumn().getName());
assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
@@ -430,7 +429,7 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
assertEquals(0, defaultAttributeOverride.getColumn().getScale());
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
Embeddable embeddable = (Embeddable) classRefs.next().getJavaPersistentType().getMapping();
@@ -446,12 +445,11 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
cityMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(6));
cityMapping.getColumn().setSpecifiedScale(Integer.valueOf(7));
- assertEquals("myEmbeddedId", attributeResource.getName());
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
+ assertEquals("myEmbeddedId", resourceField.getName());
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertEquals(2, attributeOverrideContainer.virtualOverridesSize());
- defaultAttributeOverride = attributeOverrideContainer.virtualOverrides().next();
+ assertEquals(2, attributeOverrideContainer.getVirtualOverridesSize());
+ defaultAttributeOverride = attributeOverrideContainer.getVirtualOverrides().iterator().next();
assertEquals("city", defaultAttributeOverride.getName());
assertEquals("FOO", defaultAttributeOverride.getColumn().getName());
assertEquals("BAR", defaultAttributeOverride.getColumn().getTable());
@@ -474,7 +472,7 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
cityMapping.getColumn().setSpecifiedLength(null);
cityMapping.getColumn().setSpecifiedPrecision(null);
cityMapping.getColumn().setSpecifiedScale(null);
- defaultAttributeOverride = attributeOverrideContainer.virtualOverrides().next();
+ defaultAttributeOverride = attributeOverrideContainer.getVirtualOverrides().iterator().next();
assertEquals("city", defaultAttributeOverride.getName());
assertEquals("city", defaultAttributeOverride.getColumn().getName());
assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
@@ -487,10 +485,10 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
assertEquals(0, defaultAttributeOverride.getColumn().getPrecision());
assertEquals(0, defaultAttributeOverride.getColumn().getScale());
- AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
annotation.setName("city");
getJpaProject().synchronizeContextModel();
- assertEquals(1, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals(1, attributeOverrideContainer.getVirtualOverridesSize());
}
public void testSpecifiedAttributeOverridesSize() throws Exception {
@@ -501,19 +499,19 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
AttributeOverrideContainer attributeOverrideContainer = embeddedIdMapping.getAttributeOverrideContainer();
- assertEquals(0, attributeOverrideContainer.specifiedOverridesSize());
+ assertEquals(0, attributeOverrideContainer.getSpecifiedOverridesSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
//add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("FOO");
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("BAR");
getJpaProject().synchronizeContextModel();
- assertEquals(2, attributeOverrideContainer.specifiedOverridesSize());
+ assertEquals(2, attributeOverrideContainer.getSpecifiedOverridesSize());
}
public void testAttributeOverridesSize() throws Exception {
@@ -524,24 +522,24 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
EmbeddedIdMapping embeddedIdMapping = (EmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
AttributeOverrideContainer attributeOverrideContainer = embeddedIdMapping.getAttributeOverrideContainer();
- assertEquals(2, attributeOverrideContainer.overridesSize());
+ assertEquals(2, attributeOverrideContainer.getOverridesSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
//add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("FOO");
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("BAR");
getJpaProject().synchronizeContextModel();
- assertEquals(4, attributeOverrideContainer.overridesSize());
+ assertEquals(4, attributeOverrideContainer.getOverridesSize());
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("city");
getJpaProject().synchronizeContextModel();
- assertEquals(4, attributeOverrideContainer.overridesSize());
+ assertEquals(4, attributeOverrideContainer.getOverridesSize());
}
public void testVirtualAttributeOverridesSize() throws Exception {
@@ -552,26 +550,26 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
JavaEmbeddedIdMapping embeddedIdMapping = (JavaEmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
JavaAttributeOverrideContainer attributeOverrideContainer = embeddedIdMapping.getAttributeOverrideContainer();
- assertEquals(2, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals(2, attributeOverrideContainer.getVirtualOverridesSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
//add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("FOO");
- assertEquals(2, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals(2, attributeOverrideContainer.getVirtualOverridesSize());
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("city");
getJpaProject().synchronizeContextModel();
- assertEquals(1, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals(1, attributeOverrideContainer.getVirtualOverridesSize());
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("state");
getJpaProject().synchronizeContextModel();
- assertEquals(0, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals(0, attributeOverrideContainer.getVirtualOverridesSize());
}
public void testAttributeOverrideSetVirtual() throws Exception {
@@ -582,33 +580,33 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
JavaEmbeddedIdMapping embeddedIdMapping = (JavaEmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
JavaAttributeOverrideContainer attributeOverrideContainer = embeddedIdMapping.getAttributeOverrideContainer();
- attributeOverrideContainer.virtualOverrides().next().convertToSpecified();
- attributeOverrideContainer.virtualOverrides().next().convertToSpecified();
+ attributeOverrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ attributeOverrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ Iterator<NestableAnnotation> attributeOverrides = resourceField.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertFalse(attributeOverrides.hasNext());
- attributeOverrideContainer.specifiedOverrides().next().convertToVirtual();
- attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ attributeOverrideContainer.getSpecifiedOverrides().iterator().next().convertToVirtual();
+ attributeOverrides = resourceField.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertFalse(attributeOverrides.hasNext());
- assertEquals("city", attributeOverrideContainer.virtualOverrides().next().getName());
- assertEquals(1, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals("city", attributeOverrideContainer.getVirtualOverrides().iterator().next().getName());
+ assertEquals(1, attributeOverrideContainer.getVirtualOverridesSize());
- attributeOverrideContainer.specifiedOverrides().next().convertToVirtual();
- attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ attributeOverrideContainer.getSpecifiedOverrides().iterator().next().convertToVirtual();
+ attributeOverrides = resourceField.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertFalse(attributeOverrides.hasNext());
- ListIterator<JavaVirtualAttributeOverride> virtualAttributeOverrides = attributeOverrideContainer.virtualOverrides();
+ ListIterator<JavaVirtualAttributeOverride> virtualAttributeOverrides = attributeOverrideContainer.getVirtualOverrides().iterator();
assertEquals("city", virtualAttributeOverrides.next().getName());
assertEquals("state", virtualAttributeOverrides.next().getName());
- assertEquals(2, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals(2, attributeOverrideContainer.getVirtualOverridesSize());
}
public void testAttributeOverrideSetVirtual2() throws Exception {
@@ -619,14 +617,14 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
JavaEmbeddedIdMapping embeddedIdMapping = (JavaEmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
JavaAttributeOverrideContainer attributeOverrideContainer = embeddedIdMapping.getAttributeOverrideContainer();
- ListIterator<JavaVirtualAttributeOverride> virtualAttributeOverrides = attributeOverrideContainer.virtualOverrides();
+ ListIterator<JavaVirtualAttributeOverride> virtualAttributeOverrides = attributeOverrideContainer.getVirtualOverrides().iterator();
virtualAttributeOverrides.next();
virtualAttributeOverrides.next().convertToSpecified();
- attributeOverrideContainer.virtualOverrides().next().convertToSpecified();
+ attributeOverrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ Iterator<NestableAnnotation> attributeOverrides = resourceField.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
@@ -642,16 +640,15 @@ public class JavaEmbeddedIdMappingTests extends ContextModelTestCase
JavaEmbeddedIdMapping embeddedIdMapping = (JavaEmbeddedIdMapping) getJavaPersistentType().getAttributeNamed("myEmbeddedId").getMapping();
JavaAttributeOverrideContainer attributeOverrideContainer = embeddedIdMapping.getAttributeOverrideContainer();
- attributeOverrideContainer.virtualOverrides().next().convertToSpecified();
- attributeOverrideContainer.virtualOverrides().next().convertToSpecified();
+ attributeOverrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ attributeOverrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- attributeResource.moveAnnotation(1, 0, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ resourceField.moveAnnotation(1, 0, AttributeOverrideAnnotation.ANNOTATION_NAME);
- Iterator<NestableAnnotation> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
-
+ Iterator<NestableAnnotation> attributeOverrides = resourceField.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertFalse(attributeOverrides.hasNext());
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddedMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddedMappingTests.java
index aed44ba7cf..c7ce2cafd5 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddedMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddedMappingTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,6 +12,10 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.MappingKeys;
@@ -37,17 +41,13 @@ import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedMapping;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNullAttributeMapping;
import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation;
@@ -205,7 +205,7 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
assertFalse(embeddedMapping.isDefault());
@@ -213,11 +213,11 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
assertTrue(persistentAttribute.getMapping() instanceof BasicMapping);
assertFalse(persistentAttribute.getMapping().isDefault());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToDefault() throws Exception {
@@ -226,26 +226,26 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(FULLY_QUALIFIED_EMBEDDABLE_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
- assertTrue(((EmbeddedMapping) persistentAttribute.getMapping()).getAttributeOverrideContainer().overrides().hasNext());
+ assertTrue(((EmbeddedMapping) persistentAttribute.getMapping()).getAttributeOverrideContainer().getOverrides().iterator().hasNext());
assertTrue(persistentAttribute.getMapping().isDefault());
- assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testDefaultEmbeddedMapping() throws Exception {
createTestEntityWithEmbeddedMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
assertFalse(embeddedMapping.isDefault());
@@ -265,7 +265,7 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".Entity1");
addXmlClassRef(PACKAGE_NAME + ".Embeddable1");
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
assertTrue(persistentAttribute.getMapping().isDefault());
assertNotNull(persistentAttribute.getMapping());
assertEquals(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, persistentAttribute.getDefaultMappingKey());
@@ -311,19 +311,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof VersionMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(VersionAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToTransientMapping() throws Exception {
@@ -331,19 +331,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(TransientAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToIdMapping() throws Exception {
@@ -351,19 +351,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof IdMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToEmbeddedIdMapping() throws Exception {
@@ -371,19 +371,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToOneToOneMapping() throws Exception {
@@ -391,19 +391,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToOneToManyMapping() throws Exception {
@@ -411,19 +411,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToManyToOneMapping() throws Exception {
@@ -431,19 +431,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMorphToManyToManyMapping() throws Exception {
@@ -451,19 +451,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
createEmbeddableType();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
EmbeddedMapping embeddedMapping = (EmbeddedMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
assertFalse(embeddedMapping.isDefault());
persistentAttribute.setMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping);
- assertNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testSpecifiedAttributeOverrides() throws Exception {
@@ -475,65 +475,65 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
JavaEmbeddedMapping embeddedMapping = (JavaEmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
JavaAttributeOverrideContainer attributeOverrideContainer = embeddedMapping.getAttributeOverrideContainer();
- ListIterator<JavaAttributeOverride> specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ ListIterator<JavaAttributeOverride> specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertFalse(specifiedAttributeOverrides.hasNext());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
//add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("FOO");
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("BAR");
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", specifiedAttributeOverrides.next().getName());
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("BAZ");
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
assertEquals("FOO", specifiedAttributeOverrides.next().getName());
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
//move an annotation to the resource model and verify the context model is updated
- attributeResource.moveAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES);
+ resourceField.moveAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", specifiedAttributeOverrides.next().getName());
assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ resourceField.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ resourceField.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- attributeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ resourceField.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = attributeOverrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = attributeOverrideContainer.getSpecifiedOverrides().iterator();
assertFalse(specifiedAttributeOverrides.hasNext());
}
@@ -546,14 +546,13 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
AttributeOverrideContainer attributeOverrideContainer = embeddedMapping.getAttributeOverrideContainer();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertEquals("myEmbedded", attributeResource.getName());
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertEquals("myEmbedded", resourceField.getName());
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertEquals(2, attributeOverrideContainer.virtualOverridesSize());
- ReadOnlyAttributeOverride defaultAttributeOverride = attributeOverrideContainer.virtualOverrides().next();
+ assertEquals(2, attributeOverrideContainer.getVirtualOverridesSize());
+ ReadOnlyAttributeOverride defaultAttributeOverride = attributeOverrideContainer.getVirtualOverrides().iterator().next();
assertEquals("city", defaultAttributeOverride.getName());
assertEquals("city", defaultAttributeOverride.getColumn().getName());
assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
@@ -567,7 +566,7 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
assertEquals(0, defaultAttributeOverride.getColumn().getScale());
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
Embeddable embeddable = (Embeddable) classRefs.next().getJavaPersistentType().getMapping();
@@ -583,12 +582,11 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
cityMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(6));
cityMapping.getColumn().setSpecifiedScale(Integer.valueOf(7));
- assertEquals("myEmbedded", attributeResource.getName());
- assertNull(attributeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
+ assertEquals("myEmbedded", resourceField.getName());
+ assertNull(resourceField.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertEquals(2, attributeOverrideContainer.virtualOverridesSize());
- defaultAttributeOverride = attributeOverrideContainer.virtualOverrides().next();
+ assertEquals(2, attributeOverrideContainer.getVirtualOverridesSize());
+ defaultAttributeOverride = attributeOverrideContainer.getVirtualOverrides().iterator().next();
assertEquals("city", defaultAttributeOverride.getName());
assertEquals("FOO", defaultAttributeOverride.getColumn().getName());
assertEquals("BAR", defaultAttributeOverride.getColumn().getTable());
@@ -611,7 +609,7 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
cityMapping.getColumn().setSpecifiedLength(null);
cityMapping.getColumn().setSpecifiedPrecision(null);
cityMapping.getColumn().setSpecifiedScale(null);
- defaultAttributeOverride = attributeOverrideContainer.virtualOverrides().next();
+ defaultAttributeOverride = attributeOverrideContainer.getVirtualOverrides().iterator().next();
assertEquals("city", defaultAttributeOverride.getName());
assertEquals("city", defaultAttributeOverride.getColumn().getName());
assertEquals(TYPE_NAME, defaultAttributeOverride.getColumn().getTable());
@@ -624,10 +622,10 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
assertEquals(0, defaultAttributeOverride.getColumn().getPrecision());
assertEquals(0, defaultAttributeOverride.getColumn().getScale());
- AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
annotation.setName("city");
getJpaProject().synchronizeContextModel();
- assertEquals(1, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals(1, attributeOverrideContainer.getVirtualOverridesSize());
}
public void testSpecifiedAttributeOverridesSize() throws Exception {
@@ -638,19 +636,19 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
AttributeOverrideContainer attributeOverrideContainer = embeddedMapping.getAttributeOverrideContainer();
- assertEquals(0, attributeOverrideContainer.specifiedOverridesSize());
+ assertEquals(0, attributeOverrideContainer.getSpecifiedOverridesSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
//add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("FOO");
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("BAR");
getJpaProject().synchronizeContextModel();
- assertEquals(2, attributeOverrideContainer.specifiedOverridesSize());
+ assertEquals(2, attributeOverrideContainer.getSpecifiedOverridesSize());
}
public void testAttributeOverridesSize() throws Exception {
@@ -661,24 +659,24 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
AttributeOverrideContainer attributeOverrideContainer = embeddedMapping.getAttributeOverrideContainer();
- assertEquals(2, attributeOverrideContainer.overridesSize());
+ assertEquals(2, attributeOverrideContainer.getOverridesSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
//add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("FOO");
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("BAR");
getJpaProject().synchronizeContextModel();
- assertEquals(4, attributeOverrideContainer.overridesSize());
+ assertEquals(4, attributeOverrideContainer.getOverridesSize());
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("city");
getJpaProject().synchronizeContextModel();
- assertEquals(4, attributeOverrideContainer.overridesSize());
+ assertEquals(4, attributeOverrideContainer.getOverridesSize());
}
public void testVirtualAttributeOverridesSize() throws Exception {
@@ -689,27 +687,27 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
AttributeOverrideContainer attributeOverrideContainer = embeddedMapping.getAttributeOverrideContainer();
- assertEquals(2, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals(2, attributeOverrideContainer.getVirtualOverridesSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
//add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("FOO");
getJpaProject().synchronizeContextModel();
- assertEquals(2, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals(2, attributeOverrideContainer.getVirtualOverridesSize());
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("city");
getJpaProject().synchronizeContextModel();
- assertEquals(1, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals(1, attributeOverrideContainer.getVirtualOverridesSize());
- attributeOverride = (AttributeOverrideAnnotation) attributeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceField.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("state");
getJpaProject().synchronizeContextModel();
- assertEquals(0, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals(0, attributeOverrideContainer.getVirtualOverridesSize());
}
public void testAttributeOverrideSetVirtual() throws Exception {
@@ -720,33 +718,33 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
AttributeOverrideContainer attributeOverrideContainer = embeddedMapping.getAttributeOverrideContainer();
- attributeOverrideContainer.virtualOverrides().next().convertToSpecified();
- attributeOverrideContainer.virtualOverrides().next().convertToSpecified();
+ attributeOverrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ attributeOverrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ Iterator<NestableAnnotation> attributeOverrides = resourceField.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertFalse(attributeOverrides.hasNext());
- attributeOverrideContainer.specifiedOverrides().next().convertToVirtual();
- attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ attributeOverrideContainer.getSpecifiedOverrides().iterator().next().convertToVirtual();
+ attributeOverrides = resourceField.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertFalse(attributeOverrides.hasNext());
- assertEquals("city", attributeOverrideContainer.virtualOverrides().next().getName());
- assertEquals(1, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals("city", attributeOverrideContainer.getVirtualOverrides().iterator().next().getName());
+ assertEquals(1, attributeOverrideContainer.getVirtualOverridesSize());
- attributeOverrideContainer.specifiedOverrides().next().convertToVirtual();
- attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ attributeOverrideContainer.getSpecifiedOverrides().iterator().next().convertToVirtual();
+ attributeOverrides = resourceField.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertFalse(attributeOverrides.hasNext());
- Iterator<VirtualAttributeOverride> virtualAttributeOverrides = (Iterator<VirtualAttributeOverride>) attributeOverrideContainer.virtualOverrides();
+ Iterator<? extends VirtualAttributeOverride> virtualAttributeOverrides = attributeOverrideContainer.getVirtualOverrides().iterator();
assertEquals("city", virtualAttributeOverrides.next().getName());
assertEquals("state", virtualAttributeOverrides.next().getName());
- assertEquals(2, attributeOverrideContainer.virtualOverridesSize());
+ assertEquals(2, attributeOverrideContainer.getVirtualOverridesSize());
}
public void testAttributeOverrideSetVirtual2() throws Exception {
@@ -757,14 +755,14 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
AttributeOverrideContainer attributeOverrideContainer = embeddedMapping.getAttributeOverrideContainer();
- ListIterator<VirtualAttributeOverride> virtualAttributeOverrides = (ListIterator<VirtualAttributeOverride>) attributeOverrideContainer.virtualOverrides();
+ ListIterator<? extends VirtualAttributeOverride> virtualAttributeOverrides = attributeOverrideContainer.getVirtualOverrides().iterator();
virtualAttributeOverrides.next();
virtualAttributeOverrides.next().convertToSpecified();
- attributeOverrideContainer.virtualOverrides().next().convertToSpecified();
+ attributeOverrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- Iterator<NestableAnnotation> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ Iterator<NestableAnnotation> attributeOverrides = resourceField.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
@@ -779,15 +777,15 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
EmbeddedMapping embeddedMapping = (EmbeddedMapping) getJavaPersistentType().getAttributeNamed("myEmbedded").getMapping();
AttributeOverrideContainer attributeOverrideContainer = embeddedMapping.getAttributeOverrideContainer();
- attributeOverrideContainer.virtualOverrides().next().convertToSpecified();
- attributeOverrideContainer.virtualOverrides().next().convertToSpecified();
+ attributeOverrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ attributeOverrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- attributeResource.moveAnnotation(1, 0, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ resourceField.moveAnnotation(1, 0, AttributeOverrideAnnotation.ANNOTATION_NAME);
- Iterator<NestableAnnotation> attributeOverrides = attributeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> attributeOverrides = resourceField.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("state", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertEquals("city", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
@@ -803,13 +801,13 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".Customer");
addXmlClassRef(PACKAGE_NAME + ".Address");
addXmlClassRef(PACKAGE_NAME + ".ZipCode");
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
PersistentType customerPersistentType = specifiedClassRefs.next().getJavaPersistentType();
EmbeddedMapping embeddedMapping = (EmbeddedMapping) customerPersistentType.getAttributeNamed("address").getMapping();
AttributeOverrideContainer attributeOverrideContainer = embeddedMapping.getAttributeOverrideContainer();
- assertEquals(3, attributeOverrideContainer.virtualOverridesSize());
- ListIterator<VirtualAttributeOverride> virtualAttributeOverrides = (ListIterator<VirtualAttributeOverride>) attributeOverrideContainer.virtualOverrides();
+ assertEquals(3, attributeOverrideContainer.getVirtualOverridesSize());
+ ListIterator<? extends VirtualAttributeOverride> virtualAttributeOverrides = attributeOverrideContainer.getVirtualOverrides().iterator();
ReadOnlyAttributeOverride virtualAttributeOverride = virtualAttributeOverrides.next();
assertEquals("street", virtualAttributeOverride.getName());
virtualAttributeOverride = virtualAttributeOverrides.next();
@@ -822,8 +820,8 @@ public class JavaEmbeddedMappingTests extends ContextModelTestCase
PersistentType addressPersistentType = specifiedClassRefs.next().getJavaPersistentType();
EmbeddedMapping nestedEmbeddedMapping = (EmbeddedMapping) addressPersistentType.getAttributeNamed("zipCode").getMapping();
AttributeOverrideContainer nestedAttributeOverrideContainer = nestedEmbeddedMapping.getAttributeOverrideContainer();
- assertEquals(2, nestedAttributeOverrideContainer.virtualOverridesSize());
- virtualAttributeOverrides = (ListIterator<VirtualAttributeOverride>) nestedAttributeOverrideContainer.virtualOverrides();
+ assertEquals(2, nestedAttributeOverrideContainer.getVirtualOverridesSize());
+ virtualAttributeOverrides = nestedAttributeOverrideContainer.getVirtualOverrides().iterator();
virtualAttributeOverride = virtualAttributeOverrides.next();
assertEquals("zip", virtualAttributeOverride.getName());
virtualAttributeOverride = virtualAttributeOverrides.next();
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEntityTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEntityTests.java
index 0b34da79c5..242279e950 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEntityTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEntityTests.java
@@ -12,6 +12,9 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
@@ -60,25 +63,17 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.persistence.ClassRef;
import org.eclipse.jpt.jpa.core.internal.context.java.JavaNullTypeMapping;
import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation;
-import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation;
@@ -395,9 +390,9 @@ public class JavaEntityTests extends ContextModelTestCase
entity.getTable().setSpecifiedName("FOO");
entity.addSpecifiedSecondaryTable(0);
entity.addSpecifiedPrimaryKeyJoinColumn(0);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ resourceType.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
+ resourceType.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
entity.setSpecifiedDiscriminatorValue("asdf");
entity.getDiscriminatorColumn().setSpecifiedName("BAR");
@@ -410,20 +405,20 @@ public class JavaEntityTests extends ContextModelTestCase
getJavaPersistentType().setMappingKey(MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY);
assertTrue(getJavaPersistentType().getMapping() instanceof MappedSuperclass);
- assertNull(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(TableAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNotNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(EntityAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(TableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceType.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME));
}
public void testMorphToEmbeddable() throws Exception {
@@ -434,9 +429,9 @@ public class JavaEntityTests extends ContextModelTestCase
entity.getTable().setSpecifiedName("FOO");
entity.addSpecifiedSecondaryTable(0);
entity.addSpecifiedPrimaryKeyJoinColumn(0);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ resourceType.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
+ resourceType.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
entity.setSpecifiedDiscriminatorValue("asdf");
entity.getDiscriminatorColumn().setSpecifiedName("BAR");
@@ -449,20 +444,20 @@ public class JavaEntityTests extends ContextModelTestCase
getJavaPersistentType().setMappingKey(MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY);
assertTrue(getJavaPersistentType().getMapping() instanceof Embeddable);
- assertNull(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(TableAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(EntityAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(TableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME));
}
public void testMorphToNull() throws Exception {
@@ -473,9 +468,9 @@ public class JavaEntityTests extends ContextModelTestCase
entity.getTable().setSpecifiedName("FOO");
entity.addSpecifiedSecondaryTable(0);
entity.addSpecifiedPrimaryKeyJoinColumn(0);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
- typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ resourceType.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
+ resourceType.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
entity.setSpecifiedInheritanceStrategy(InheritanceType.JOINED);
entity.setSpecifiedDiscriminatorValue("asdf");
entity.getDiscriminatorColumn().setSpecifiedName("BAR");
@@ -488,20 +483,20 @@ public class JavaEntityTests extends ContextModelTestCase
getJavaPersistentType().setMappingKey(MappingKeys.NULL_TYPE_MAPPING_KEY);
assertTrue(getJavaPersistentType().getMapping() instanceof JavaNullTypeMapping);
- assertNull(typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(TableAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(NamedQueryAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(NamedNativeQueryAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(EntityAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(TableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME));
}
public void testAccessNoAnnotations() throws Exception {
@@ -526,9 +521,9 @@ public class JavaEntityTests extends ContextModelTestCase
assertEquals(AccessType.PROPERTY, childPersistentType.getAccess());
((IdMapping) superPersistentType.getAttributeNamed("id").getMapping()).getColumn().setSpecifiedName("FOO");
- JavaResourcePersistentType resourceType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- resourceType.persistableProperties().next().removeAnnotation(JPA.ID);
+ resourceType.getMethods().iterator().next().removeAnnotation(JPA.ID);
getJpaProject().synchronizeContextModel();
//no mapping(Id) annotation, but still a Column annotation, so access should still be property
assertEquals(AccessType.PROPERTY, superPersistentType.getAccess());
@@ -570,9 +565,9 @@ public class JavaEntityTests extends ContextModelTestCase
assertEquals(AccessType.PROPERTY, getJavaPersistentType().getAccess());
((IdMapping) getJavaPersistentType().getAttributeNamed("id").getMapping()).getColumn().setSpecifiedName("FOO");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- typeResource.persistableProperties().next().removeAnnotation(JPA.ID);
+ resourceType.getMethods().iterator().next().removeAnnotation(JPA.ID);
getJpaProject().synchronizeContextModel();
//no mapping(Id) annotation, but still a Column annotation, so access should still be property
assertEquals(AccessType.PROPERTY, getJavaPersistentType().getAccess());
@@ -649,9 +644,9 @@ public class JavaEntityTests extends ContextModelTestCase
assertEquals("foo", getJavaEntity().getSpecifiedName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- assertEquals("foo", ((EntityAnnotation) typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME)).getName());
+ assertEquals("foo", ((EntityAnnotation) resourceType.getAnnotation(EntityAnnotation.ANNOTATION_NAME)).getName());
}
public void testSetSpecifiedNameNull() throws Exception {
@@ -662,17 +657,17 @@ public class JavaEntityTests extends ContextModelTestCase
assertNull(getJavaEntity().getSpecifiedName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- assertNull(((EntityAnnotation) typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME)).getName());
+ assertNull(((EntityAnnotation) resourceType.getAnnotation(EntityAnnotation.ANNOTATION_NAME)).getName());
}
public void testUpdateFromSpecifiedNameChangeInResourceModel() throws Exception {
createTestEntityWithName();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- EntityAnnotation entity = (EntityAnnotation) typeResource.getAnnotation(EntityAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ EntityAnnotation entity = (EntityAnnotation) resourceType.getAnnotation(EntityAnnotation.ANNOTATION_NAME);
entity.setName("foo");
getJpaProject().synchronizeContextModel();
@@ -731,7 +726,7 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
Entity childEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
Entity rootEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
@@ -753,8 +748,8 @@ public class JavaEntityTests extends ContextModelTestCase
assertEquals(InheritanceType.TABLE_PER_CLASS, getJavaEntity().getSpecifiedInheritanceStrategy());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ InheritanceAnnotation inheritance = (InheritanceAnnotation) resourceType.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
inheritance.setStrategy(org.eclipse.jpt.jpa.core.resource.java.InheritanceType.JOINED);
getJpaProject().synchronizeContextModel();
@@ -776,8 +771,8 @@ public class JavaEntityTests extends ContextModelTestCase
assertEquals(InheritanceType.JOINED, getJavaEntity().getSpecifiedInheritanceStrategy());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- InheritanceAnnotation inheritance = (InheritanceAnnotation) typeResource.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ InheritanceAnnotation inheritance = (InheritanceAnnotation) resourceType.getAnnotation(InheritanceAnnotation.ANNOTATION_NAME);
assertEquals(org.eclipse.jpt.jpa.core.resource.java.InheritanceType.JOINED, inheritance.getStrategy());
}
@@ -810,8 +805,8 @@ public class JavaEntityTests extends ContextModelTestCase
assertEquals(DISCRIMINATOR_VALUE, getJavaEntity().getSpecifiedDiscriminatorValue());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) resourceType.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
discriminatorValue.setValue("foo");
getJpaProject().synchronizeContextModel();
@@ -833,8 +828,8 @@ public class JavaEntityTests extends ContextModelTestCase
assertEquals("foo", getJavaEntity().getSpecifiedDiscriminatorValue());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) typeResource.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorValueAnnotation discriminatorValue = (DiscriminatorValueAnnotation) resourceType.getAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME);
assertEquals("foo", discriminatorValue.getValue());
}
@@ -842,7 +837,7 @@ public class JavaEntityTests extends ContextModelTestCase
createTestEntityWithSecondaryTable();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<JavaSecondaryTable> secondaryTables = getJavaEntity().secondaryTables();
+ ListIterator<JavaSecondaryTable> secondaryTables = getJavaEntity().getSecondaryTables().iterator();
assertTrue(secondaryTables.hasNext());
assertEquals("foo", secondaryTables.next().getName());
@@ -854,23 +849,23 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
Entity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- assertEquals(0, entity.secondaryTablesSize());
+ assertEquals(0, entity.getSecondaryTablesSize());
- ((SecondaryTableAnnotation) typeResource.addAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((SecondaryTableAnnotation) typeResource.addAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((SecondaryTableAnnotation) typeResource.addAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAZ");
+ ((SecondaryTableAnnotation) resourceType.addAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME)).setName("FOO");
+ ((SecondaryTableAnnotation) resourceType.addAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME)).setName("BAR");
+ ((SecondaryTableAnnotation) resourceType.addAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME)).setName("BAZ");
getJpaProject().synchronizeContextModel();
- assertEquals(3, entity.secondaryTablesSize());
+ assertEquals(3, entity.getSecondaryTablesSize());
}
public void testSpecifiedSecondaryTables() throws Exception {
createTestEntityWithSecondaryTables();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<JavaSecondaryTable> specifiedSecondaryTables = getJavaEntity().specifiedSecondaryTables();
+ ListIterator<JavaSecondaryTable> specifiedSecondaryTables = getJavaEntity().getSpecifiedSecondaryTables().iterator();
assertTrue(specifiedSecondaryTables.hasNext());
assertEquals("foo", specifiedSecondaryTables.next().getName());
@@ -883,16 +878,16 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
Entity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- assertEquals(0, entity.specifiedSecondaryTablesSize());
+ assertEquals(0, entity.getSpecifiedSecondaryTablesSize());
- ((SecondaryTableAnnotation) typeResource.addAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((SecondaryTableAnnotation) typeResource.addAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((SecondaryTableAnnotation) typeResource.addAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAZ");
+ ((SecondaryTableAnnotation) resourceType.addAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME)).setName("FOO");
+ ((SecondaryTableAnnotation) resourceType.addAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME)).setName("BAR");
+ ((SecondaryTableAnnotation) resourceType.addAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME)).setName("BAZ");
getJpaProject().synchronizeContextModel();
- assertEquals(3, entity.specifiedSecondaryTablesSize());
+ assertEquals(3, entity.getSpecifiedSecondaryTablesSize());
}
public void testAddSpecifiedSecondaryTable() throws Exception {
@@ -903,8 +898,8 @@ public class JavaEntityTests extends ContextModelTestCase
getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAR");
getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAZ");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- Iterator<NestableAnnotation> secondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ Iterator<NestableAnnotation> secondaryTables = resourceType.getAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
assertEquals("BAR", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
@@ -920,8 +915,8 @@ public class JavaEntityTests extends ContextModelTestCase
getJavaEntity().addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
getJavaEntity().addSpecifiedSecondaryTable(0).setSpecifiedName("BAZ");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- Iterator<NestableAnnotation> secondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ Iterator<NestableAnnotation> secondaryTables = resourceType.getAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTables.next()).getName());
@@ -944,20 +939,20 @@ public class JavaEntityTests extends ContextModelTestCase
specifiedSecondaryTable2.setSpecifiedName("BAR");
- Iterator<JavaSecondaryTable> secondaryTables = getJavaEntity().secondaryTables();
+ Iterator<JavaSecondaryTable> secondaryTables = getJavaEntity().getSecondaryTables().iterator();
SecondaryTable secondaryTable = secondaryTables.next();
assertEquals(secondaryTable, specifiedSecondaryTable);
assertEquals("FOO", secondaryTable.getName());
assertEquals("CATALOG", secondaryTable.getCatalog());
assertEquals("SCHEMA", secondaryTable.getSchema());
- assertEquals(1, secondaryTable.specifiedPrimaryKeyJoinColumnsSize());
- PrimaryKeyJoinColumn pkJoinColumn = secondaryTable.specifiedPrimaryKeyJoinColumns().next();
+ assertEquals(1, secondaryTable.getSpecifiedPrimaryKeyJoinColumnsSize());
+ PrimaryKeyJoinColumn pkJoinColumn = secondaryTable.getSpecifiedPrimaryKeyJoinColumns().iterator().next();
assertEquals("PK_NAME", pkJoinColumn.getName());
secondaryTable = secondaryTables.next();
assertEquals(secondaryTable, specifiedSecondaryTable2);
assertEquals("BAR", secondaryTable.getName());
- assertEquals(0, secondaryTable.specifiedPrimaryKeyJoinColumnsSize());
+ assertEquals(0, secondaryTable.getSpecifiedPrimaryKeyJoinColumnsSize());
}
@@ -969,40 +964,40 @@ public class JavaEntityTests extends ContextModelTestCase
getJavaEntity().addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
getJavaEntity().addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- assertEquals(3, CollectionTools.size(typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)));
+ assertEquals(3, resourceType.getAnnotationsSize(SecondaryTableAnnotation.ANNOTATION_NAME));
getJavaEntity().removeSpecifiedSecondaryTable(1);
- Iterator<NestableAnnotation> secondaryTableResources = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> secondaryTableResources = resourceType.getAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME).iterator();
assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTableResources.next()).getName());
assertEquals("BAZ", ((SecondaryTableAnnotation) secondaryTableResources.next()).getName());
assertFalse(secondaryTableResources.hasNext());
- Iterator<JavaSecondaryTable> secondaryTables = getJavaEntity().secondaryTables();
+ Iterator<JavaSecondaryTable> secondaryTables = getJavaEntity().getSecondaryTables().iterator();
assertEquals("FOO", secondaryTables.next().getName());
assertEquals("BAZ", secondaryTables.next().getName());
assertFalse(secondaryTables.hasNext());
getJavaEntity().removeSpecifiedSecondaryTable(1);
- secondaryTableResources = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ secondaryTableResources = resourceType.getAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME).iterator();
assertEquals("FOO", ((SecondaryTableAnnotation) secondaryTableResources.next()).getName());
assertFalse(secondaryTableResources.hasNext());
- secondaryTables = getJavaEntity().secondaryTables();
+ secondaryTables = getJavaEntity().getSecondaryTables().iterator();
assertEquals("FOO", secondaryTables.next().getName());
assertFalse(secondaryTables.hasNext());
getJavaEntity().removeSpecifiedSecondaryTable(0);
- secondaryTableResources = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ secondaryTableResources = resourceType.getAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME).iterator();
assertFalse(secondaryTableResources.hasNext());
- secondaryTables = getJavaEntity().secondaryTables();
+ secondaryTables = getJavaEntity().getSecondaryTables().iterator();
assertFalse(secondaryTables.hasNext());
- assertNull(typeResource.getAnnotation(SecondaryTablesAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(SecondaryTableAnnotation.ANNOTATION_NAME));
}
public void testMoveSpecifiedSecondaryTable() throws Exception {
@@ -1010,35 +1005,35 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
entity.addSpecifiedSecondaryTable(0).setSpecifiedName("FOO");
entity.addSpecifiedSecondaryTable(1).setSpecifiedName("BAR");
entity.addSpecifiedSecondaryTable(2).setSpecifiedName("BAZ");
- Iterator<NestableAnnotation> javaSecondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> javaSecondaryTables = resourceType.getAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME).iterator();
assertEquals(3, CollectionTools.size(javaSecondaryTables));
entity.moveSpecifiedSecondaryTable(2, 0);
- ListIterator<JavaSecondaryTable> secondaryTables = entity.specifiedSecondaryTables();
+ ListIterator<JavaSecondaryTable> secondaryTables = entity.getSpecifiedSecondaryTables().iterator();
assertEquals("BAR", secondaryTables.next().getSpecifiedName());
assertEquals("BAZ", secondaryTables.next().getSpecifiedName());
assertEquals("FOO", secondaryTables.next().getSpecifiedName());
- javaSecondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ javaSecondaryTables = resourceType.getAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAR", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName());
assertEquals("BAZ", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName());
assertEquals("FOO", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName());
entity.moveSpecifiedSecondaryTable(0, 1);
- secondaryTables = entity.specifiedSecondaryTables();
+ secondaryTables = entity.getSpecifiedSecondaryTables().iterator();
assertEquals("BAZ", secondaryTables.next().getSpecifiedName());
assertEquals("BAR", secondaryTables.next().getSpecifiedName());
assertEquals("FOO", secondaryTables.next().getSpecifiedName());
- javaSecondaryTables = typeResource.annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ javaSecondaryTables = resourceType.getAnnotations(SecondaryTableAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAZ", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName());
assertEquals("BAR", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName());
assertEquals("FOO", ((SecondaryTableAnnotation) javaSecondaryTables.next()).getName());
@@ -1049,51 +1044,51 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- ((SecondaryTableAnnotation) typeResource.addAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((SecondaryTableAnnotation) typeResource.addAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((SecondaryTableAnnotation) typeResource.addAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME)).setName("BAZ");
+ ((SecondaryTableAnnotation) resourceType.addAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME)).setName("FOO");
+ ((SecondaryTableAnnotation) resourceType.addAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME)).setName("BAR");
+ ((SecondaryTableAnnotation) resourceType.addAnnotation(2, SecondaryTableAnnotation.ANNOTATION_NAME)).setName("BAZ");
getJpaProject().synchronizeContextModel();
- ListIterator<JavaSecondaryTable> secondaryTables = entity.specifiedSecondaryTables();
+ ListIterator<JavaSecondaryTable> secondaryTables = entity.getSpecifiedSecondaryTables().iterator();
assertEquals("FOO", secondaryTables.next().getName());
assertEquals("BAR", secondaryTables.next().getName());
assertEquals("BAZ", secondaryTables.next().getName());
assertFalse(secondaryTables.hasNext());
- typeResource.moveAnnotation(2, 0, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ resourceType.moveAnnotation(2, 0, SecondaryTableAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- secondaryTables = entity.specifiedSecondaryTables();
+ secondaryTables = entity.getSpecifiedSecondaryTables().iterator();
assertEquals("BAR", secondaryTables.next().getName());
assertEquals("BAZ", secondaryTables.next().getName());
assertEquals("FOO", secondaryTables.next().getName());
assertFalse(secondaryTables.hasNext());
- typeResource.moveAnnotation(0, 1, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ resourceType.moveAnnotation(0, 1, SecondaryTableAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- secondaryTables = entity.specifiedSecondaryTables();
+ secondaryTables = entity.getSpecifiedSecondaryTables().iterator();
assertEquals("BAZ", secondaryTables.next().getName());
assertEquals("BAR", secondaryTables.next().getName());
assertEquals("FOO", secondaryTables.next().getName());
assertFalse(secondaryTables.hasNext());
- typeResource.removeAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- secondaryTables = entity.specifiedSecondaryTables();
+ secondaryTables = entity.getSpecifiedSecondaryTables().iterator();
assertEquals("BAZ", secondaryTables.next().getName());
assertEquals("FOO", secondaryTables.next().getName());
assertFalse(secondaryTables.hasNext());
- typeResource.removeAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(1, SecondaryTableAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- secondaryTables = entity.specifiedSecondaryTables();
+ secondaryTables = entity.getSpecifiedSecondaryTables().iterator();
assertEquals("BAZ", secondaryTables.next().getName());
assertFalse(secondaryTables.hasNext());
- typeResource.removeAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(0, SecondaryTableAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- secondaryTables = entity.specifiedSecondaryTables();
+ secondaryTables = entity.getSpecifiedSecondaryTables().iterator();
assertFalse(secondaryTables.hasNext());
}
@@ -1117,7 +1112,7 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
Entity childEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
Entity rootEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
@@ -1141,7 +1136,7 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
Entity childEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
Entity rootEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
@@ -1163,30 +1158,30 @@ public class JavaEntityTests extends ContextModelTestCase
createTestEntityWithName();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ SecondaryTableAnnotation secondaryTable = (SecondaryTableAnnotation) resourceType.addAnnotation(0, JPA.SECONDARY_TABLE);
secondaryTable.setName("FOO");
getJpaProject().synchronizeContextModel();
- assertEquals(1, getJavaEntity().secondaryTablesSize());
- assertEquals("FOO", getJavaEntity().secondaryTables().next().getSpecifiedName());
- assertEquals("FOO", getJavaEntity().secondaryTables().next().getName());
+ assertEquals(1, getJavaEntity().getSecondaryTablesSize());
+ assertEquals("FOO", getJavaEntity().getSecondaryTables().iterator().next().getSpecifiedName());
+ assertEquals("FOO", getJavaEntity().getSecondaryTables().iterator().next().getName());
- SecondaryTableAnnotation secondaryTable2 = (SecondaryTableAnnotation) typeResource.addAnnotation(1, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ SecondaryTableAnnotation secondaryTable2 = (SecondaryTableAnnotation) resourceType.addAnnotation(1, JPA.SECONDARY_TABLE);
secondaryTable2.setName("BAR");
getJpaProject().synchronizeContextModel();
- assertEquals(2, getJavaEntity().secondaryTablesSize());
- ListIterator<JavaSecondaryTable> secondaryTables = getJavaEntity().secondaryTables();
+ assertEquals(2, getJavaEntity().getSecondaryTablesSize());
+ ListIterator<JavaSecondaryTable> secondaryTables = getJavaEntity().getSecondaryTables().iterator();
assertEquals("FOO", secondaryTables.next().getSpecifiedName());
assertEquals("BAR", secondaryTables.next().getSpecifiedName());
- SecondaryTableAnnotation secondaryTable3 = (SecondaryTableAnnotation) typeResource.addAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ SecondaryTableAnnotation secondaryTable3 = (SecondaryTableAnnotation) resourceType.addAnnotation(0, JPA.SECONDARY_TABLE);
secondaryTable3.setName("BAZ");
getJpaProject().synchronizeContextModel();
- assertEquals(3, getJavaEntity().secondaryTablesSize());
- secondaryTables = getJavaEntity().secondaryTables();
+ assertEquals(3, getJavaEntity().getSecondaryTablesSize());
+ secondaryTables = getJavaEntity().getSecondaryTables().iterator();
assertEquals("BAZ", secondaryTables.next().getSpecifiedName());
assertEquals("FOO", secondaryTables.next().getSpecifiedName());
assertEquals("BAR", secondaryTables.next().getSpecifiedName());
@@ -1197,35 +1192,35 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
getJavaEntity().addSpecifiedSecondaryTable(2).setSpecifiedName("baz");
- ListIterator<JavaSecondaryTable> secondaryTables = getJavaEntity().secondaryTables();
+ ListIterator<JavaSecondaryTable> secondaryTables = getJavaEntity().getSecondaryTables().iterator();
- assertEquals(3, getJavaEntity().secondaryTablesSize());
+ assertEquals(3, getJavaEntity().getSecondaryTablesSize());
assertEquals("foo", secondaryTables.next().getSpecifiedName());
assertEquals("bar", secondaryTables.next().getSpecifiedName());
assertEquals("baz", secondaryTables.next().getSpecifiedName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ resourceType.removeAnnotation(0, JPA.SECONDARY_TABLE);
getJpaProject().synchronizeContextModel();
- assertEquals(2, getJavaEntity().secondaryTablesSize());
- secondaryTables = getJavaEntity().secondaryTables();
+ assertEquals(2, getJavaEntity().getSecondaryTablesSize());
+ secondaryTables = getJavaEntity().getSecondaryTables().iterator();
assertEquals("bar", secondaryTables.next().getSpecifiedName());
assertEquals("baz", secondaryTables.next().getSpecifiedName());
- typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ resourceType.removeAnnotation(0, JPA.SECONDARY_TABLE);
getJpaProject().synchronizeContextModel();
- secondaryTables = getJavaEntity().secondaryTables();
- assertEquals(1, getJavaEntity().secondaryTablesSize());
+ secondaryTables = getJavaEntity().getSecondaryTables().iterator();
+ assertEquals(1, getJavaEntity().getSecondaryTablesSize());
assertEquals("baz", secondaryTables.next().getSpecifiedName());
- typeResource.removeAnnotation(0, JPA.SECONDARY_TABLE, JPA.SECONDARY_TABLES);
+ resourceType.removeAnnotation(0, JPA.SECONDARY_TABLE);
getJpaProject().synchronizeContextModel();
- secondaryTables = getJavaEntity().secondaryTables();
- assertEquals(0, getJavaEntity().secondaryTablesSize());
+ secondaryTables = getJavaEntity().getSecondaryTables().iterator();
+ assertEquals(0, getJavaEntity().getSecondaryTablesSize());
assertFalse(secondaryTables.hasNext());
}
@@ -1234,18 +1229,18 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
assertNull(getJavaEntity().getGeneratorContainer().getSequenceGenerator());
- assertEquals(0, getJavaEntity().getPersistenceUnit().generatorsSize());
+ assertEquals(0, getJavaEntity().getPersistenceUnit().getGeneratorsSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addAnnotation(JPA.SEQUENCE_GENERATOR);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ resourceType.addAnnotation(JPA.SEQUENCE_GENERATOR);
getJpaProject().synchronizeContextModel();
assertNotNull(getJavaEntity().getGeneratorContainer().getSequenceGenerator());
- assertEquals(2, typeResource.annotationsSize());
- assertEquals(1, getJavaEntity().getPersistenceUnit().generatorsSize());
+ assertEquals(2, resourceType.getAnnotationsSize());
+ assertEquals(1, getJavaEntity().getPersistenceUnit().getGeneratorsSize());
getJavaEntity().getGeneratorContainer().getSequenceGenerator().setName("foo");
- assertEquals(1, getJavaEntity().getPersistenceUnit().generatorsSize());
+ assertEquals(1, getJavaEntity().getPersistenceUnit().getGeneratorsSize());
}
public void testAddSequenceGenerator() throws Exception {
@@ -1256,9 +1251,9 @@ public class JavaEntityTests extends ContextModelTestCase
getJavaEntity().getGeneratorContainer().addSequenceGenerator();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- assertNotNull(typeResource.getAnnotation(JPA.SEQUENCE_GENERATOR));
+ assertNotNull(resourceType.getAnnotation(JPA.SEQUENCE_GENERATOR));
assertNotNull(getJavaEntity().getGeneratorContainer().getSequenceGenerator());
//try adding another sequence generator, should get an IllegalStateException
@@ -1274,14 +1269,14 @@ public class JavaEntityTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addAnnotation(JPA.SEQUENCE_GENERATOR);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ resourceType.addAnnotation(JPA.SEQUENCE_GENERATOR);
getJpaProject().synchronizeContextModel();
getJavaEntity().getGeneratorContainer().removeSequenceGenerator();
assertNull(getJavaEntity().getGeneratorContainer().getSequenceGenerator());
- assertNull(typeResource.getAnnotation(JPA.SEQUENCE_GENERATOR));
+ assertNull(resourceType.getAnnotation(JPA.SEQUENCE_GENERATOR));
//try removing the sequence generator again, should get an IllegalStateException
try {
@@ -1297,18 +1292,18 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
assertNull(getJavaEntity().getGeneratorContainer().getTableGenerator());
- assertEquals(0, getJavaEntity().getPersistenceUnit().generatorsSize());
+ assertEquals(0, getJavaEntity().getPersistenceUnit().getGeneratorsSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addAnnotation(JPA.TABLE_GENERATOR);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ resourceType.addAnnotation(JPA.TABLE_GENERATOR);
getJpaProject().synchronizeContextModel();
assertNotNull(getJavaEntity().getGeneratorContainer().getTableGenerator());
- assertEquals(2, typeResource.annotationsSize());
- assertEquals(1, getJavaEntity().getPersistenceUnit().generatorsSize());
+ assertEquals(2, resourceType.getAnnotationsSize());
+ assertEquals(1, getJavaEntity().getPersistenceUnit().getGeneratorsSize());
getJavaEntity().getGeneratorContainer().getTableGenerator().setName("foo");
- assertEquals(1, getJavaEntity().getPersistenceUnit().generatorsSize());
+ assertEquals(1, getJavaEntity().getPersistenceUnit().getGeneratorsSize());
}
public void testAddTableGenerator() throws Exception {
@@ -1319,9 +1314,9 @@ public class JavaEntityTests extends ContextModelTestCase
getJavaEntity().getGeneratorContainer().addTableGenerator();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- assertNotNull(typeResource.getAnnotation(JPA.TABLE_GENERATOR));
+ assertNotNull(resourceType.getAnnotation(JPA.TABLE_GENERATOR));
assertNotNull(getJavaEntity().getGeneratorContainer().getTableGenerator());
//try adding another table generator, should get an IllegalStateException
@@ -1337,14 +1332,14 @@ public class JavaEntityTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- typeResource.addAnnotation(JPA.TABLE_GENERATOR);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ resourceType.addAnnotation(JPA.TABLE_GENERATOR);
getJpaProject().synchronizeContextModel();
getJavaEntity().getGeneratorContainer().removeTableGenerator();
assertNull(getJavaEntity().getGeneratorContainer().getTableGenerator());
- assertNull(typeResource.getAnnotation(JPA.TABLE_GENERATOR));
+ assertNull(resourceType.getAnnotation(JPA.TABLE_GENERATOR));
//try removing the table generator again, should get an IllegalStateException
try {
@@ -1361,8 +1356,8 @@ public class JavaEntityTests extends ContextModelTestCase
assertNotNull(getJavaEntity().getDiscriminatorColumn());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) typeResource.addAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ DiscriminatorColumnAnnotation column = (DiscriminatorColumnAnnotation) resourceType.addAnnotation(JPA.DISCRIMINATOR_COLUMN);
column.setName("foo");
getJpaProject().synchronizeContextModel();
@@ -1373,7 +1368,7 @@ public class JavaEntityTests extends ContextModelTestCase
assertNull(getJavaEntity().getDiscriminatorColumn().getSpecifiedName());
- typeResource.removeAnnotation(JPA.DISCRIMINATOR_COLUMN);
+ resourceType.removeAnnotation(JPA.DISCRIMINATOR_COLUMN);
getJpaProject().synchronizeContextModel();
assertNotNull(getJavaEntity().getDiscriminatorColumn());
@@ -1383,64 +1378,64 @@ public class JavaEntityTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<JavaPrimaryKeyJoinColumn> specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
+ ListIterator<JavaPrimaryKeyJoinColumn> specifiedPkJoinColumns = getJavaEntity().getSpecifiedPrimaryKeyJoinColumns().iterator();
assertFalse(specifiedPkJoinColumns.hasNext());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
//add an annotation to the resource model and verify the context model is updated
- PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ PrimaryKeyJoinColumnAnnotation pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) resourceType.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN);
pkJoinColumn.setName("FOO");
getJpaProject().synchronizeContextModel();
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
+ specifiedPkJoinColumns = getJavaEntity().getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("FOO", specifiedPkJoinColumns.next().getName());
assertFalse(specifiedPkJoinColumns.hasNext());
- pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) resourceType.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN);
pkJoinColumn.setName("BAR");
getJpaProject().synchronizeContextModel();
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
+ specifiedPkJoinColumns = getJavaEntity().getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("BAR", specifiedPkJoinColumns.next().getName());
assertEquals("FOO", specifiedPkJoinColumns.next().getName());
assertFalse(specifiedPkJoinColumns.hasNext());
- pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ pkJoinColumn = (PrimaryKeyJoinColumnAnnotation) resourceType.addAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN);
pkJoinColumn.setName("BAZ");
getJpaProject().synchronizeContextModel();
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
+ specifiedPkJoinColumns = getJavaEntity().getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
assertEquals("BAR", specifiedPkJoinColumns.next().getName());
assertEquals("FOO", specifiedPkJoinColumns.next().getName());
assertFalse(specifiedPkJoinColumns.hasNext());
//move an annotation to the resource model and verify the context model is updated
- typeResource.moveAnnotation(1, 0, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ resourceType.moveAnnotation(1, 0, JPA.PRIMARY_KEY_JOIN_COLUMN);
getJpaProject().synchronizeContextModel();
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
+ specifiedPkJoinColumns = getJavaEntity().getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("BAR", specifiedPkJoinColumns.next().getName());
assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
assertEquals("FOO", specifiedPkJoinColumns.next().getName());
assertFalse(specifiedPkJoinColumns.hasNext());
- typeResource.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ resourceType.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN);
getJpaProject().synchronizeContextModel();
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
+ specifiedPkJoinColumns = getJavaEntity().getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("BAZ", specifiedPkJoinColumns.next().getName());
assertEquals("FOO", specifiedPkJoinColumns.next().getName());
assertFalse(specifiedPkJoinColumns.hasNext());
- typeResource.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ resourceType.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN);
getJpaProject().synchronizeContextModel();
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
+ specifiedPkJoinColumns = getJavaEntity().getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("FOO", specifiedPkJoinColumns.next().getName());
assertFalse(specifiedPkJoinColumns.hasNext());
- typeResource.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN, JPA.PRIMARY_KEY_JOIN_COLUMNS);
+ resourceType.removeAnnotation(0, JPA.PRIMARY_KEY_JOIN_COLUMN);
getJpaProject().synchronizeContextModel();
- specifiedPkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
+ specifiedPkJoinColumns = getJavaEntity().getSpecifiedPrimaryKeyJoinColumns().iterator();
assertFalse(specifiedPkJoinColumns.hasNext());
}
@@ -1448,13 +1443,13 @@ public class JavaEntityTests extends ContextModelTestCase
createTestEntity();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- assertEquals(0, getJavaEntity().specifiedPrimaryKeyJoinColumnsSize());
+ assertEquals(0, getJavaEntity().getSpecifiedPrimaryKeyJoinColumnsSize());
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
- assertEquals(3, getJavaEntity().specifiedPrimaryKeyJoinColumnsSize());
+ assertEquals(3, getJavaEntity().getSpecifiedPrimaryKeyJoinColumnsSize());
}
public void testPrimaryKeyJoinColumnsSize() throws Exception {
@@ -1462,14 +1457,14 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
//just the default pkJoinColumn, so 1
- assertEquals(1, getJavaEntity().primaryKeyJoinColumnsSize());
+ assertEquals(1, getJavaEntity().getPrimaryKeyJoinColumnsSize());
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
//only the specified pkJoinColumns, 3
- assertEquals(3, getJavaEntity().primaryKeyJoinColumnsSize());
+ assertEquals(3, getJavaEntity().getPrimaryKeyJoinColumnsSize());
}
public void testGetDefaultPrimaryKeyJoinColumn() throws Exception {
@@ -1493,8 +1488,8 @@ public class JavaEntityTests extends ContextModelTestCase
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAR");
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("BAZ");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- Iterator<NestableAnnotation> pkJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ Iterator<NestableAnnotation> pkJoinColumns = resourceType.getAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
@@ -1510,8 +1505,8 @@ public class JavaEntityTests extends ContextModelTestCase
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- Iterator<NestableAnnotation> pkJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ Iterator<NestableAnnotation> pkJoinColumns = resourceType.getAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME).iterator();
assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumns.next()).getName());
@@ -1526,40 +1521,40 @@ public class JavaEntityTests extends ContextModelTestCase
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- assertEquals(3, CollectionTools.size(typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)));
+ assertEquals(3, resourceType.getAnnotationsSize(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME));
getJavaEntity().removeSpecifiedPrimaryKeyJoinColumn(1);
- Iterator<NestableAnnotation> pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> pkJoinColumnResources = resourceType.getAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME).iterator();
assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumnResources.next()).getName());
assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumnResources.next()).getName());
assertFalse(pkJoinColumnResources.hasNext());
- Iterator<JavaPrimaryKeyJoinColumn> pkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
+ Iterator<JavaPrimaryKeyJoinColumn> pkJoinColumns = getJavaEntity().getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("FOO", pkJoinColumns.next().getName());
assertEquals("BAZ", pkJoinColumns.next().getName());
assertFalse(pkJoinColumns.hasNext());
getJavaEntity().removeSpecifiedPrimaryKeyJoinColumn(1);
- pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ pkJoinColumnResources = resourceType.getAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME).iterator();
assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) pkJoinColumnResources.next()).getName());
assertFalse(pkJoinColumnResources.hasNext());
- pkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
+ pkJoinColumns = getJavaEntity().getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("FOO", pkJoinColumns.next().getName());
assertFalse(pkJoinColumns.hasNext());
getJavaEntity().removeSpecifiedPrimaryKeyJoinColumn(0);
- pkJoinColumnResources = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ pkJoinColumnResources = resourceType.getAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME).iterator();
assertFalse(pkJoinColumnResources.hasNext());
- pkJoinColumns = getJavaEntity().specifiedPrimaryKeyJoinColumns();
+ pkJoinColumns = getJavaEntity().getSpecifiedPrimaryKeyJoinColumns().iterator();
assertFalse(pkJoinColumns.hasNext());
- assertNull(typeResource.getAnnotation(PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME));
}
public void testMoveSpecifiedPrimaryKeyJoinColumn() throws Exception {
@@ -1567,35 +1562,35 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
entity.addSpecifiedPrimaryKeyJoinColumn(0).setSpecifiedName("FOO");
entity.addSpecifiedPrimaryKeyJoinColumn(1).setSpecifiedName("BAR");
entity.addSpecifiedPrimaryKeyJoinColumn(2).setSpecifiedName("BAZ");
- Iterator<NestableAnnotation> javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> javaPrimaryKeyJoinColumns = resourceType.getAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME).iterator();
assertEquals(3, CollectionTools.size(javaPrimaryKeyJoinColumns));
entity.moveSpecifiedPrimaryKeyJoinColumn(2, 0);
- ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
- javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ javaPrimaryKeyJoinColumns = resourceType.getAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName());
assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName());
assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName());
entity.moveSpecifiedPrimaryKeyJoinColumn(0, 1);
- primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ primaryKeyJoinColumns = entity.getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("BAZ", primaryKeyJoinColumns.next().getSpecifiedName());
assertEquals("BAR", primaryKeyJoinColumns.next().getSpecifiedName());
assertEquals("FOO", primaryKeyJoinColumns.next().getSpecifiedName());
- javaPrimaryKeyJoinColumns = typeResource.annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ javaPrimaryKeyJoinColumns = resourceType.getAnnotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAZ", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName());
assertEquals("BAR", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName());
assertEquals("FOO", ((PrimaryKeyJoinColumnAnnotation) javaPrimaryKeyJoinColumns.next()).getName());
@@ -1606,51 +1601,51 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- ((PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((PrimaryKeyJoinColumnAnnotation) typeResource.addAnnotation(2, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME)).setName("BAZ");
+ ((PrimaryKeyJoinColumnAnnotation) resourceType.addAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME)).setName("FOO");
+ ((PrimaryKeyJoinColumnAnnotation) resourceType.addAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME)).setName("BAR");
+ ((PrimaryKeyJoinColumnAnnotation) resourceType.addAnnotation(2, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME)).setName("BAZ");
getJpaProject().synchronizeContextModel();
- ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ ListIterator<JavaPrimaryKeyJoinColumn> primaryKeyJoinColumns = entity.getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("FOO", primaryKeyJoinColumns.next().getName());
assertEquals("BAR", primaryKeyJoinColumns.next().getName());
assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
assertFalse(primaryKeyJoinColumns.hasNext());
- typeResource.moveAnnotation(2, 0, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ resourceType.moveAnnotation(2, 0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ primaryKeyJoinColumns = entity.getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("BAR", primaryKeyJoinColumns.next().getName());
assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
assertEquals("FOO", primaryKeyJoinColumns.next().getName());
assertFalse(primaryKeyJoinColumns.hasNext());
- typeResource.moveAnnotation(0, 1, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ resourceType.moveAnnotation(0, 1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ primaryKeyJoinColumns = entity.getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
assertEquals("BAR", primaryKeyJoinColumns.next().getName());
assertEquals("FOO", primaryKeyJoinColumns.next().getName());
assertFalse(primaryKeyJoinColumns.hasNext());
- typeResource.removeAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ primaryKeyJoinColumns = entity.getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
assertEquals("FOO", primaryKeyJoinColumns.next().getName());
assertFalse(primaryKeyJoinColumns.hasNext());
- typeResource.removeAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(1, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ primaryKeyJoinColumns = entity.getSpecifiedPrimaryKeyJoinColumns().iterator();
assertEquals("BAZ", primaryKeyJoinColumns.next().getName());
assertFalse(primaryKeyJoinColumns.hasNext());
- typeResource.removeAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(0, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- primaryKeyJoinColumns = entity.specifiedPrimaryKeyJoinColumns();
+ primaryKeyJoinColumns = entity.getSpecifiedPrimaryKeyJoinColumns().iterator();
assertFalse(primaryKeyJoinColumns.hasNext());
}
@@ -1661,7 +1656,7 @@ public class JavaEntityTests extends ContextModelTestCase
assertTrue(getJavaEntity().getDefaultPrimaryKeyJoinColumn().isDefault());
getJavaEntity().addSpecifiedPrimaryKeyJoinColumn(0);
- PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().specifiedPrimaryKeyJoinColumns().next();
+ PrimaryKeyJoinColumn specifiedPkJoinColumn = getJavaEntity().getSpecifiedPrimaryKeyJoinColumns().iterator().next();
assertFalse(specifiedPkJoinColumn.isDefault());
assertNull(getJavaEntity().getDefaultPrimaryKeyJoinColumn());
@@ -1755,7 +1750,7 @@ public class JavaEntityTests extends ContextModelTestCase
assertFalse(overridableAttributes.hasNext());
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
JavaEntity abstractEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
overridableAttributes = abstractEntity.allOverridableAttributeNames();
@@ -1777,7 +1772,7 @@ public class JavaEntityTests extends ContextModelTestCase
assertFalse(overridableAssociations.hasNext());
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
JavaEntity abstractEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
overridableAssociations = abstractEntity.allOverridableAssociationNames();
@@ -1819,64 +1814,64 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaAttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- ListIterator<JavaAttributeOverride> specifiedAttributeOverrides = overrideContainer.specifiedOverrides();
+ ListIterator<JavaAttributeOverride> specifiedAttributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertFalse(specifiedAttributeOverrides.hasNext());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
//add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) resourceType.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("FOO");
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = overrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceType.addAnnotation(1, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("BAR");
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = overrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", specifiedAttributeOverrides.next().getName());
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceType.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("BAZ");
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = overrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
assertEquals("FOO", specifiedAttributeOverrides.next().getName());
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
//move an annotation to the resource model and verify the context model is updated
- typeResource.moveAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDES);
+ resourceType.moveAnnotation(1, 0, JPA.ATTRIBUTE_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = overrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", specifiedAttributeOverrides.next().getName());
assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- typeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ resourceType.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = overrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", specifiedAttributeOverrides.next().getName());
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- typeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ resourceType.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = overrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAR", specifiedAttributeOverrides.next().getName());
assertFalse(specifiedAttributeOverrides.hasNext());
- typeResource.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ resourceType.removeAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAttributeOverrides = overrideContainer.specifiedOverrides();
+ specifiedAttributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertFalse(specifiedAttributeOverrides.hasNext());
}
@@ -1887,18 +1882,17 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
JavaEntity javaEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
AttributeOverrideContainer overrideContainer = javaEntity.getAttributeOverrideContainer();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
+ assertEquals(SUB_TYPE_NAME, resourceType.getName());
+ assertNull(resourceType.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertEquals(4, overrideContainer.virtualOverridesSize());
- VirtualAttributeOverride virtualAttributeOverride = overrideContainer.virtualOverrides().next();
+ assertEquals(4, overrideContainer.getVirtualOverridesSize());
+ VirtualAttributeOverride virtualAttributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("foo", virtualAttributeOverride.getName());
assertEquals("foo", virtualAttributeOverride.getColumn().getName());
assertEquals(SUB_TYPE_NAME, virtualAttributeOverride.getColumn().getTable());
@@ -1926,12 +1920,11 @@ public class JavaEntityTests extends ContextModelTestCase
fooMapping.getColumn().setSpecifiedPrecision(Integer.valueOf(6));
fooMapping.getColumn().setSpecifiedScale(Integer.valueOf(7));
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
+ assertEquals(SUB_TYPE_NAME, resourceType.getName());
+ assertNull(resourceType.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertEquals(4, overrideContainer.virtualOverridesSize());
- virtualAttributeOverride = overrideContainer.virtualOverrides().next();
+ assertEquals(4, overrideContainer.getVirtualOverridesSize());
+ virtualAttributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("foo", virtualAttributeOverride.getName());
assertEquals("FOO", virtualAttributeOverride.getColumn().getName());
assertEquals("BAR", virtualAttributeOverride.getColumn().getTable());
@@ -1954,11 +1947,10 @@ public class JavaEntityTests extends ContextModelTestCase
fooMapping.getColumn().setSpecifiedLength(null);
fooMapping.getColumn().setSpecifiedPrecision(null);
fooMapping.getColumn().setSpecifiedScale(null);
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
+ assertEquals(SUB_TYPE_NAME, resourceType.getName());
+ assertNull(resourceType.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
- virtualAttributeOverride = overrideContainer.virtualOverrides().next();
+ virtualAttributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("foo", virtualAttributeOverride.getName());
assertEquals("foo", virtualAttributeOverride.getColumn().getName());
assertEquals(SUB_TYPE_NAME, virtualAttributeOverride.getColumn().getTable());
@@ -1972,7 +1964,7 @@ public class JavaEntityTests extends ContextModelTestCase
assertEquals(0, virtualAttributeOverride.getColumn().getScale());
virtualAttributeOverride.convertToSpecified();
- assertEquals(3, overrideContainer.virtualOverridesSize());
+ assertEquals(3, overrideContainer.getVirtualOverridesSize());
}
public void testVirtualAttributeOverridesEntityHierachy() throws Exception {
@@ -1982,18 +1974,17 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
JavaEntity javaEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
AttributeOverrideContainer overrideContainer = javaEntity.getAttributeOverrideContainer();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
+ assertEquals(SUB_TYPE_NAME, resourceType.getName());
+ assertNull(resourceType.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertEquals(3, overrideContainer.virtualOverridesSize());
- VirtualAttributeOverride virtualAttributeOverride = overrideContainer.virtualOverrides().next();
+ assertEquals(3, overrideContainer.getVirtualOverridesSize());
+ VirtualAttributeOverride virtualAttributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("id", virtualAttributeOverride.getName());
assertEquals("id", virtualAttributeOverride.getColumn().getName());
assertEquals(SUB_TYPE_NAME, virtualAttributeOverride.getColumn().getTable());
@@ -2005,29 +1996,27 @@ public class JavaEntityTests extends ContextModelTestCase
idMapping.getColumn().setSpecifiedName("FOO");
idMapping.getColumn().setSpecifiedTable("BAR");
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
+ assertEquals(SUB_TYPE_NAME, resourceType.getName());
+ assertNull(resourceType.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertEquals(3, overrideContainer.virtualOverridesSize());
- virtualAttributeOverride = overrideContainer.virtualOverrides().next();
+ assertEquals(3, overrideContainer.getVirtualOverridesSize());
+ virtualAttributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("id", virtualAttributeOverride.getName());
assertEquals("FOO", virtualAttributeOverride.getColumn().getName());
assertEquals("BAR", virtualAttributeOverride.getColumn().getTable());
idMapping.getColumn().setSpecifiedName(null);
idMapping.getColumn().setSpecifiedTable(null);
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getAnnotation(AttributeOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
+ assertEquals(SUB_TYPE_NAME, resourceType.getName());
+ assertNull(resourceType.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
- virtualAttributeOverride = overrideContainer.virtualOverrides().next();
+ virtualAttributeOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("id", virtualAttributeOverride.getName());
assertEquals("id", virtualAttributeOverride.getColumn().getName());
assertEquals(SUB_TYPE_NAME, virtualAttributeOverride.getColumn().getTable());
virtualAttributeOverride.convertToSpecified();
- assertEquals(2, overrideContainer.virtualOverridesSize());
+ assertEquals(2, overrideContainer.getVirtualOverridesSize());
}
public void testSpecifiedAttributeOverridesSize() throws Exception {
@@ -2035,18 +2024,18 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
AttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- assertEquals(0, overrideContainer.specifiedOverridesSize());
+ assertEquals(0, overrideContainer.getSpecifiedOverridesSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
//add an annotation to the resource model and verify the context model is updated
- AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ AttributeOverrideAnnotation attributeOverride = (AttributeOverrideAnnotation) resourceType.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("FOO");
- attributeOverride = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ attributeOverride = (AttributeOverrideAnnotation) resourceType.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
attributeOverride.setName("BAR");
getJpaProject().synchronizeContextModel();
- assertEquals(2, overrideContainer.specifiedOverridesSize());
+ assertEquals(2, overrideContainer.getSpecifiedOverridesSize());
}
public void testVirtualAttributeOverridesSize() throws Exception {
@@ -2057,19 +2046,19 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
AttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- assertEquals(4, overrideContainer.virtualOverridesSize());
+ assertEquals(4, overrideContainer.getVirtualOverridesSize());
- overrideContainer.virtualOverrides().next().convertToSpecified();
- assertEquals(3, overrideContainer.virtualOverridesSize());
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ assertEquals(3, overrideContainer.getVirtualOverridesSize());
- overrideContainer.virtualOverrides().next().convertToSpecified();
- assertEquals(2, overrideContainer.virtualOverridesSize());
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ assertEquals(2, overrideContainer.getVirtualOverridesSize());
- overrideContainer.virtualOverrides().next().convertToSpecified();
- assertEquals(1, overrideContainer.virtualOverridesSize());
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ assertEquals(1, overrideContainer.getVirtualOverridesSize());
- overrideContainer.virtualOverrides().next().convertToSpecified();
- assertEquals(0, overrideContainer.virtualOverridesSize());
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ assertEquals(0, overrideContainer.getVirtualOverridesSize());
}
public void testAttributeOverridesSize() throws Exception {
@@ -2080,20 +2069,20 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
AttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- assertEquals(4, overrideContainer.overridesSize());
+ assertEquals(4, overrideContainer.getOverridesSize());
- overrideContainer.virtualOverrides().next().convertToSpecified();
- assertEquals(4, overrideContainer.overridesSize());
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ assertEquals(4, overrideContainer.getOverridesSize());
- overrideContainer.virtualOverrides().next().convertToSpecified();
- assertEquals(4, overrideContainer.overridesSize());
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ assertEquals(4, overrideContainer.getOverridesSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) typeResource.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE, JPA.ATTRIBUTE_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
+ AttributeOverrideAnnotation annotation = (AttributeOverrideAnnotation) resourceType.addAnnotation(0, JPA.ATTRIBUTE_OVERRIDE);
annotation.setName("bar");
getJpaProject().synchronizeContextModel();
- assertEquals(5, overrideContainer.overridesSize());
+ assertEquals(5, overrideContainer.getOverridesSize());
}
public void testAttributeOverrideSetVirtual() throws Exception {
@@ -2105,11 +2094,11 @@ public class JavaEntityTests extends ContextModelTestCase
AttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- overrideContainer.virtualOverrides().next().convertToSpecified();
- overrideContainer.virtualOverrides().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- Iterator<NestableAnnotation> attributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
+ Iterator<NestableAnnotation> attributeOverrides = resourceType.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("foo", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertEquals("basic", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
@@ -2125,13 +2114,13 @@ public class JavaEntityTests extends ContextModelTestCase
JavaAttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- ListIterator<JavaVirtualAttributeOverride> virtualAttributeOverrides = overrideContainer.virtualOverrides();
+ ListIterator<JavaVirtualAttributeOverride> virtualAttributeOverrides = overrideContainer.getVirtualOverrides().iterator();
virtualAttributeOverrides.next();
virtualAttributeOverrides.next().convertToSpecified();
- overrideContainer.virtualOverrides().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- Iterator<NestableAnnotation> attributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
+ Iterator<NestableAnnotation> attributeOverrides = resourceType.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("basic", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
assertEquals("foo", ((AttributeOverrideAnnotation) attributeOverrides.next()).getName());
@@ -2147,43 +2136,43 @@ public class JavaEntityTests extends ContextModelTestCase
JavaAttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- overrideContainer.virtualOverrides().next().convertToSpecified();
- overrideContainer.virtualOverrides().next().convertToSpecified();
- overrideContainer.virtualOverrides().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- assertEquals(3, CollectionTools.size(typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
+ assertEquals(3, CollectionTools.size(resourceType.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME)));
- overrideContainer.specifiedOverrides().next().convertToVirtual();
+ overrideContainer.getSpecifiedOverrides().iterator().next().convertToVirtual();
- Iterator<NestableAnnotation> attributeOverrideResources = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> attributeOverrideResources = resourceType.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("basic", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName());
assertEquals("id", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName());
assertFalse(attributeOverrideResources.hasNext());
- Iterator<JavaAttributeOverride> attributeOverrides = overrideContainer.specifiedOverrides();
+ Iterator<JavaAttributeOverride> attributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("basic", attributeOverrides.next().getName());
assertEquals("id", attributeOverrides.next().getName());
assertFalse(attributeOverrides.hasNext());
- overrideContainer.specifiedOverrides().next().convertToVirtual();
- attributeOverrideResources = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ overrideContainer.getSpecifiedOverrides().iterator().next().convertToVirtual();
+ attributeOverrideResources = resourceType.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("id", ((AttributeOverrideAnnotation) attributeOverrideResources.next()).getName());
assertFalse(attributeOverrideResources.hasNext());
- attributeOverrides = overrideContainer.specifiedOverrides();
+ attributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("id", attributeOverrides.next().getName());
assertFalse(attributeOverrides.hasNext());
- overrideContainer.specifiedOverrides().next().convertToVirtual();
- attributeOverrideResources = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ overrideContainer.getSpecifiedOverrides().iterator().next().convertToVirtual();
+ attributeOverrideResources = resourceType.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertFalse(attributeOverrideResources.hasNext());
- attributeOverrides = overrideContainer.specifiedOverrides();
+ attributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertFalse(attributeOverrides.hasNext());
- assertNull(typeResource.getAnnotation(AttributeOverridesAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME));
}
public void testMoveSpecifiedAttributeOverride() throws Exception {
@@ -2194,35 +2183,35 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaAttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- overrideContainer.virtualOverrides().next().convertToSpecified();
- overrideContainer.virtualOverrides().next().convertToSpecified();
- overrideContainer.virtualOverrides().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
- Iterator<NestableAnnotation> javaAttributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> javaAttributeOverrides = resourceType.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals(3, CollectionTools.size(javaAttributeOverrides));
overrideContainer.moveSpecifiedOverride(2, 0);
- ListIterator<JavaAttributeOverride> attributeOverrides = overrideContainer.specifiedOverrides();
+ ListIterator<JavaAttributeOverride> attributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("basic", attributeOverrides.next().getName());
assertEquals("id", attributeOverrides.next().getName());
assertEquals("foo", attributeOverrides.next().getName());
- javaAttributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ javaAttributeOverrides = resourceType.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("basic", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName());
assertEquals("id", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName());
assertEquals("foo", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName());
overrideContainer.moveSpecifiedOverride(0, 1);
- attributeOverrides = overrideContainer.specifiedOverrides();
+ attributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("id", attributeOverrides.next().getName());
assertEquals("basic", attributeOverrides.next().getName());
assertEquals("foo", attributeOverrides.next().getName());
- javaAttributeOverrides = typeResource.annotations(AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ javaAttributeOverrides = resourceType.getAnnotations(AttributeOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("id", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName());
assertEquals("basic", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName());
assertEquals("foo", ((AttributeOverrideAnnotation) javaAttributeOverrides.next()).getName());
@@ -2233,51 +2222,51 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaAttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- ((AttributeOverrideAnnotation) typeResource.addAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((AttributeOverrideAnnotation) typeResource.addAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((AttributeOverrideAnnotation) typeResource.addAnnotation(2, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME)).setName("BAZ");
+ ((AttributeOverrideAnnotation) resourceType.addAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME)).setName("FOO");
+ ((AttributeOverrideAnnotation) resourceType.addAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME)).setName("BAR");
+ ((AttributeOverrideAnnotation) resourceType.addAnnotation(2, AttributeOverrideAnnotation.ANNOTATION_NAME)).setName("BAZ");
getJpaProject().synchronizeContextModel();
- ListIterator<JavaAttributeOverride> attributeOverrides = overrideContainer.specifiedOverrides();
+ ListIterator<JavaAttributeOverride> attributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", attributeOverrides.next().getName());
assertEquals("BAR", attributeOverrides.next().getName());
assertEquals("BAZ", attributeOverrides.next().getName());
assertFalse(attributeOverrides.hasNext());
- typeResource.moveAnnotation(2, 0, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ resourceType.moveAnnotation(2, 0, AttributeOverrideAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- attributeOverrides = overrideContainer.specifiedOverrides();
+ attributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAR", attributeOverrides.next().getName());
assertEquals("BAZ", attributeOverrides.next().getName());
assertEquals("FOO", attributeOverrides.next().getName());
assertFalse(attributeOverrides.hasNext());
- typeResource.moveAnnotation(0, 1, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ resourceType.moveAnnotation(0, 1, AttributeOverrideAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- attributeOverrides = overrideContainer.specifiedOverrides();
+ attributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", attributeOverrides.next().getName());
assertEquals("BAR", attributeOverrides.next().getName());
assertEquals("FOO", attributeOverrides.next().getName());
assertFalse(attributeOverrides.hasNext());
- typeResource.removeAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- attributeOverrides = overrideContainer.specifiedOverrides();
+ attributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", attributeOverrides.next().getName());
assertEquals("FOO", attributeOverrides.next().getName());
assertFalse(attributeOverrides.hasNext());
- typeResource.removeAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(1, AttributeOverrideAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- attributeOverrides = overrideContainer.specifiedOverrides();
+ attributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", attributeOverrides.next().getName());
assertFalse(attributeOverrides.hasNext());
- typeResource.removeAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME, AttributeOverridesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(0, AttributeOverrideAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- attributeOverrides = overrideContainer.specifiedOverrides();
+ attributeOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertFalse(attributeOverrides.hasNext());
}
@@ -2289,7 +2278,7 @@ public class JavaEntityTests extends ContextModelTestCase
JavaAttributeOverrideContainer overrideContainer = getJavaEntity().getAttributeOverrideContainer();
- ListIterator<JavaVirtualAttributeOverride> virtualAttributeOverrides = overrideContainer.virtualOverrides();
+ ListIterator<JavaVirtualAttributeOverride> virtualAttributeOverrides = overrideContainer.getVirtualOverrides().iterator();
JavaVirtualAttributeOverride virtualAttributeOverride = virtualAttributeOverrides.next();
assertEquals("foo", virtualAttributeOverride.getName());
assertTrue(virtualAttributeOverride.isVirtual());
@@ -2307,12 +2296,12 @@ public class JavaEntityTests extends ContextModelTestCase
assertTrue(virtualAttributeOverride.isVirtual());
assertFalse(virtualAttributeOverrides.hasNext());
- overrideContainer.virtualOverrides().next().convertToSpecified();
- AttributeOverride specifiedAttributeOverride = overrideContainer.specifiedOverrides().next();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ AttributeOverride specifiedAttributeOverride = overrideContainer.getSpecifiedOverrides().iterator().next();
assertFalse(specifiedAttributeOverride.isVirtual());
- virtualAttributeOverrides = overrideContainer.virtualOverrides();
+ virtualAttributeOverrides = overrideContainer.getVirtualOverrides().iterator();
virtualAttributeOverride = virtualAttributeOverrides.next();
assertEquals("basic", virtualAttributeOverride.getName());
assertTrue(virtualAttributeOverride.isVirtual());
@@ -2376,64 +2365,64 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaAssociationOverrideContainer overrideContainer = getJavaEntity().getAssociationOverrideContainer();
- ListIterator<JavaAssociationOverride> specifiedAssociationOverrides = overrideContainer.specifiedOverrides();
+ ListIterator<JavaAssociationOverride> specifiedAssociationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertFalse(specifiedAssociationOverrides.hasNext());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
//add an annotation to the resource model and verify the context model is updated
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) resourceType.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
associationOverride.setName("FOO");
getJpaProject().synchronizeContextModel();
- specifiedAssociationOverrides = overrideContainer.specifiedOverrides();
+ specifiedAssociationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", specifiedAssociationOverrides.next().getName());
assertFalse(specifiedAssociationOverrides.hasNext());
- associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ associationOverride = (AssociationOverrideAnnotation) resourceType.addAnnotation(1, JPA.ASSOCIATION_OVERRIDE);
associationOverride.setName("BAR");
getJpaProject().synchronizeContextModel();
- specifiedAssociationOverrides = overrideContainer.specifiedOverrides();
+ specifiedAssociationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", specifiedAssociationOverrides.next().getName());
assertEquals("BAR", specifiedAssociationOverrides.next().getName());
assertFalse(specifiedAssociationOverrides.hasNext());
- associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ associationOverride = (AssociationOverrideAnnotation) resourceType.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
associationOverride.setName("BAZ");
getJpaProject().synchronizeContextModel();
- specifiedAssociationOverrides = overrideContainer.specifiedOverrides();
+ specifiedAssociationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", specifiedAssociationOverrides.next().getName());
assertEquals("FOO", specifiedAssociationOverrides.next().getName());
assertEquals("BAR", specifiedAssociationOverrides.next().getName());
assertFalse(specifiedAssociationOverrides.hasNext());
//move an annotation to the resource model and verify the context model is updated
- typeResource.moveAnnotation(1, 0, JPA.ASSOCIATION_OVERRIDES);
+ resourceType.moveAnnotation(1, 0, JPA.ASSOCIATION_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAssociationOverrides = overrideContainer.specifiedOverrides();
+ specifiedAssociationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", specifiedAssociationOverrides.next().getName());
assertEquals("BAZ", specifiedAssociationOverrides.next().getName());
assertEquals("BAR", specifiedAssociationOverrides.next().getName());
assertFalse(specifiedAssociationOverrides.hasNext());
- typeResource.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ resourceType.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAssociationOverrides = overrideContainer.specifiedOverrides();
+ specifiedAssociationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", specifiedAssociationOverrides.next().getName());
assertEquals("BAR", specifiedAssociationOverrides.next().getName());
assertFalse(specifiedAssociationOverrides.hasNext());
- typeResource.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ resourceType.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAssociationOverrides = overrideContainer.specifiedOverrides();
+ specifiedAssociationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAR", specifiedAssociationOverrides.next().getName());
assertFalse(specifiedAssociationOverrides.hasNext());
- typeResource.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ resourceType.removeAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
getJpaProject().synchronizeContextModel();
- specifiedAssociationOverrides = overrideContainer.specifiedOverrides();
+ specifiedAssociationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertFalse(specifiedAssociationOverrides.hasNext());
}
@@ -2444,22 +2433,21 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(FULLY_QUALIFIED_SUB_TYPE_NAME);
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
JavaEntity javaEntity = (JavaEntity) classRefs.next().getJavaPersistentType().getMapping();
AssociationOverrideContainer overrideContainer = javaEntity.getAssociationOverrideContainer();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
+ assertEquals(SUB_TYPE_NAME, resourceType.getName());
+ assertNull(resourceType.getAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertEquals(2, overrideContainer.virtualOverridesSize());
- VirtualAssociationOverride virtualAssociationOverride = overrideContainer.virtualOverrides().next();
+ assertEquals(2, overrideContainer.getVirtualOverridesSize());
+ VirtualAssociationOverride virtualAssociationOverride = overrideContainer.getVirtualOverrides().iterator().next();
ReadOnlyJoinColumnRelationshipStrategy joiningStrategy = ((ReadOnlyJoinColumnRelationship) virtualAssociationOverride.getRelationship()).getJoinColumnStrategy();
assertEquals("oneToOne", virtualAssociationOverride.getName());
- assertEquals(1, joiningStrategy.joinColumnsSize());
- ReadOnlyJoinColumn virtualJoinColumn = joiningStrategy.joinColumns().next();
+ assertEquals(1, joiningStrategy.getJoinColumnsSize());
+ ReadOnlyJoinColumn virtualJoinColumn = joiningStrategy.getJoinColumns().iterator().next();
assertEquals("oneToOne_id", virtualJoinColumn.getName());
assertEquals("id", virtualJoinColumn.getReferencedColumnName());
assertEquals(SUB_TYPE_NAME, virtualJoinColumn.getTable());
@@ -2481,17 +2469,16 @@ public class JavaEntityTests extends ContextModelTestCase
joinColumn.setSpecifiedUnique(Boolean.TRUE);
joinColumn.setSpecifiedNullable(Boolean.FALSE);
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME));
+ assertEquals(SUB_TYPE_NAME, resourceType.getName());
+ assertNull(resourceType.getAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertEquals(2, overrideContainer.virtualOverridesSize());
- virtualAssociationOverride = overrideContainer.virtualOverrides().next();
+ assertEquals(2, overrideContainer.getVirtualOverridesSize());
+ virtualAssociationOverride = overrideContainer.getVirtualOverrides().iterator().next();
joiningStrategy = ((ReadOnlyJoinColumnRelationship) virtualAssociationOverride.getRelationship()).getJoinColumnStrategy();
assertEquals("oneToOne", virtualAssociationOverride.getName());
- assertEquals(1, joiningStrategy.joinColumnsSize());
- virtualAssociationOverride = overrideContainer.virtualOverrides().next();
- virtualJoinColumn = joiningStrategy.joinColumns().next();
+ assertEquals(1, joiningStrategy.getJoinColumnsSize());
+ virtualAssociationOverride = overrideContainer.getVirtualOverrides().iterator().next();
+ virtualJoinColumn = joiningStrategy.getJoinColumns().iterator().next();
assertEquals("MY_JOIN_COLUMN", virtualJoinColumn.getName());
assertEquals("MY_REFERENCE_COLUMN", virtualJoinColumn.getReferencedColumnName());
assertEquals("BAR", virtualJoinColumn.getTable());
@@ -2501,7 +2488,7 @@ public class JavaEntityTests extends ContextModelTestCase
assertEquals(true, virtualJoinColumn.isUnique());
assertEquals(false, virtualJoinColumn.isNullable());
- assertEquals("MY_JOIN_COLUMN", joiningStrategy.joinColumns().next().getName());
+ assertEquals("MY_JOIN_COLUMN", joiningStrategy.getJoinColumns().iterator().next().getName());
@@ -2510,15 +2497,14 @@ public class JavaEntityTests extends ContextModelTestCase
//idMapping.getColumn().setSpecifiedName(null);
//idMapping.getColumn().setSpecifiedTable(null);
- assertEquals(SUB_TYPE_NAME, typeResource.getName());
- assertNull(typeResource.getAnnotation(AssociationOverrideAnnotation.ANNOTATION_NAME));
- assertNull(typeResource.getAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME));
+ assertEquals(SUB_TYPE_NAME, resourceType.getName());
+ assertNull(resourceType.getAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME));
- virtualAssociationOverride = overrideContainer.virtualOverrides().next();
+ virtualAssociationOverride = overrideContainer.getVirtualOverrides().iterator().next();
assertEquals("oneToOne", virtualAssociationOverride.getName());
virtualAssociationOverride.convertToSpecified();
- assertEquals(1, overrideContainer.virtualOverridesSize());
+ assertEquals(1, overrideContainer.getVirtualOverridesSize());
@@ -2537,9 +2523,9 @@ public class JavaEntityTests extends ContextModelTestCase
//// joinColumn.setSpecifiedReferencedColumnName("BAR");
//// joinColumn.setSpecifiedTable("BAZ");
////
-//// assertEquals(SUB_TYPE_NAME, typeResource.getName());
-//// assertNull(typeResource.annotation(AssociationOverride.ANNOTATION_NAME));
-//// assertNull(typeResource.annotation(AssociationOverrides.ANNOTATION_NAME));
+//// assertEquals(SUB_TYPE_NAME, resourceType.getName());
+//// assertNull(resourceType.annotation(AssociationOverride.ANNOTATION_NAME));
+//// assertNull(resourceType.annotation(AssociationOverrides.ANNOTATION_NAME));
////
//// assertEquals(1, CollectionTools.size(javaEntity.defaultAssociationOverrides()));
//// defaultAssociationOverride = javaEntity.defaultAssociationOverrides().next();
@@ -2551,9 +2537,9 @@ public class JavaEntityTests extends ContextModelTestCase
//// joinColumn.setSpecifiedName(null);
//// joinColumn.setSpecifiedReferencedColumnName(null);
//// joinColumn.setSpecifiedTable(null);
-//// assertEquals(SUB_TYPE_NAME, typeResource.getName());
-//// assertNull(typeResource.annotation(AssociationOverride.ANNOTATION_NAME));
-//// assertNull(typeResource.annotation(AssociationOverrides.ANNOTATION_NAME));
+//// assertEquals(SUB_TYPE_NAME, resourceType.getName());
+//// assertNull(resourceType.annotation(AssociationOverride.ANNOTATION_NAME));
+//// assertNull(resourceType.annotation(AssociationOverrides.ANNOTATION_NAME));
////
//// defaultAssociationOverride = javaEntity.defaultAssociationOverrides().next();
//// assertEquals("address", defaultJoinColumn.getName());
@@ -2570,18 +2556,18 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
AssociationOverrideContainer overrideContainer = getJavaEntity().getAssociationOverrideContainer();
- assertEquals(0, overrideContainer.specifiedOverridesSize());
+ assertEquals(0, overrideContainer.getSpecifiedOverridesSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
//add an annotation to the resource model and verify the context model is updated
- AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ AssociationOverrideAnnotation associationOverride = (AssociationOverrideAnnotation) resourceType.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
associationOverride.setName("FOO");
- associationOverride = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ associationOverride = (AssociationOverrideAnnotation) resourceType.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
associationOverride.setName("BAR");
getJpaProject().synchronizeContextModel();
- assertEquals(2, overrideContainer.specifiedOverridesSize());
+ assertEquals(2, overrideContainer.getSpecifiedOverridesSize());
}
public void testVirtualAssociationOverridesSize() throws Exception {
@@ -2592,13 +2578,13 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
AssociationOverrideContainer overrideContainer = getJavaEntity().getAssociationOverrideContainer();
- assertEquals(2, overrideContainer.virtualOverridesSize());
+ assertEquals(2, overrideContainer.getVirtualOverridesSize());
- overrideContainer.virtualOverrides().next().convertToSpecified();
- assertEquals(1, overrideContainer.virtualOverridesSize());
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ assertEquals(1, overrideContainer.getVirtualOverridesSize());
- overrideContainer.virtualOverrides().next().convertToSpecified();
- assertEquals(0, overrideContainer.virtualOverridesSize());
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ assertEquals(0, overrideContainer.getVirtualOverridesSize());
}
public void testAssociationOverridesSize() throws Exception {
@@ -2610,20 +2596,20 @@ public class JavaEntityTests extends ContextModelTestCase
AssociationOverrideContainer overrideContainer = getJavaEntity().getAssociationOverrideContainer();
- assertEquals(2, overrideContainer.overridesSize());
+ assertEquals(2, overrideContainer.getOverridesSize());
- overrideContainer.virtualOverrides().next().convertToSpecified();
- assertEquals(2, overrideContainer.overridesSize());
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ assertEquals(2, overrideContainer.getOverridesSize());
- overrideContainer.virtualOverrides().next().convertToSpecified();
- assertEquals(2, overrideContainer.overridesSize());
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ assertEquals(2, overrideContainer.getOverridesSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- AssociationOverrideAnnotation annotation = (AssociationOverrideAnnotation) typeResource.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE, JPA.ASSOCIATION_OVERRIDES);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
+ AssociationOverrideAnnotation annotation = (AssociationOverrideAnnotation) resourceType.addAnnotation(0, JPA.ASSOCIATION_OVERRIDE);
annotation.setName("bar");
getJpaProject().synchronizeContextModel();
- assertEquals(3, overrideContainer.overridesSize());
+ assertEquals(3, overrideContainer.getOverridesSize());
}
public void testAssociationOverrideSetVirtual() throws Exception {
@@ -2634,11 +2620,11 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
AssociationOverrideContainer overrideContainer = getJavaEntity().getAssociationOverrideContainer();
- overrideContainer.virtualOverrides().next().convertToSpecified();
- overrideContainer.virtualOverrides().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- Iterator<NestableAnnotation> associationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
+ Iterator<NestableAnnotation> associationOverrides = resourceType.getAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("oneToOne", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
assertEquals("manyToOne", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
@@ -2653,13 +2639,13 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaAssociationOverrideContainer overrideContainer = getJavaEntity().getAssociationOverrideContainer();
- ListIterator<JavaVirtualAssociationOverride> virtualAssociationOverrides = overrideContainer.virtualOverrides();
+ ListIterator<JavaVirtualAssociationOverride> virtualAssociationOverrides = overrideContainer.getVirtualOverrides().iterator();
virtualAssociationOverrides.next();
virtualAssociationOverrides.next().convertToSpecified();
- overrideContainer.virtualOverrides().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- Iterator<NestableAnnotation> associationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
+ Iterator<NestableAnnotation> associationOverrides = resourceType.getAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("manyToOne", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
assertEquals("oneToOne", ((AssociationOverrideAnnotation) associationOverrides.next()).getName());
@@ -2674,30 +2660,30 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaAssociationOverrideContainer overrideContainer = getJavaEntity().getAssociationOverrideContainer();
- overrideContainer.virtualOverrides().next().convertToSpecified();
- overrideContainer.virtualOverrides().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
- assertEquals(2, CollectionTools.size(typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
+ assertEquals(2, resourceType.getAnnotationsSize(AssociationOverrideAnnotation.ANNOTATION_NAME));
- overrideContainer.specifiedOverrides().next().convertToVirtual();
+ overrideContainer.getSpecifiedOverrides().iterator().next().convertToVirtual();
- Iterator<NestableAnnotation> associationOverrideResources = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> associationOverrideResources = resourceType.getAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("manyToOne", ((AssociationOverrideAnnotation) associationOverrideResources.next()).getName());
assertFalse(associationOverrideResources.hasNext());
- Iterator<JavaAssociationOverride> associationOverrides = overrideContainer.specifiedOverrides();
+ Iterator<JavaAssociationOverride> associationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("manyToOne", associationOverrides.next().getName());
assertFalse(associationOverrides.hasNext());
- overrideContainer.specifiedOverrides().next().convertToVirtual();
- associationOverrideResources = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
+ overrideContainer.getSpecifiedOverrides().iterator().next().convertToVirtual();
+ associationOverrideResources = resourceType.getAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME).iterator();
assertFalse(associationOverrideResources.hasNext());
- associationOverrides = overrideContainer.specifiedOverrides();
+ associationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertFalse(associationOverrides.hasNext());
- assertNull(typeResource.getAnnotation(AssociationOverridesAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME));
}
public void testMoveSpecifiedAssociationOverride() throws Exception {
@@ -2708,32 +2694,32 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaAssociationOverrideContainer overrideContainer = getJavaEntity().getAssociationOverrideContainer();
- overrideContainer.virtualOverrides().next().convertToSpecified();
- overrideContainer.virtualOverrides().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_SUB_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_SUB_TYPE_NAME, Kind.TYPE);
- Iterator<NestableAnnotation> javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> javaAssociationOverrides = resourceType.getAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals(2, CollectionTools.size(javaAssociationOverrides));
overrideContainer.moveSpecifiedOverride(1, 0);
- ListIterator<JavaAssociationOverride> associationOverrides = overrideContainer.specifiedOverrides();
+ ListIterator<JavaAssociationOverride> associationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("manyToOne", associationOverrides.next().getName());
assertEquals("oneToOne", associationOverrides.next().getName());
- javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
+ javaAssociationOverrides = resourceType.getAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("manyToOne", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName());
assertEquals("oneToOne", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName());
overrideContainer.moveSpecifiedOverride(0, 1);
- associationOverrides = overrideContainer.specifiedOverrides();
+ associationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("oneToOne", associationOverrides.next().getName());
assertEquals("manyToOne", associationOverrides.next().getName());
- javaAssociationOverrides = typeResource.annotations(AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
+ javaAssociationOverrides = resourceType.getAnnotations(AssociationOverrideAnnotation.ANNOTATION_NAME).iterator();
assertEquals("oneToOne", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName());
assertEquals("manyToOne", ((AssociationOverrideAnnotation) javaAssociationOverrides.next()).getName());
}
@@ -2743,51 +2729,51 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaAssociationOverrideContainer overrideContainer = getJavaEntity().getAssociationOverrideContainer();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- ((AssociationOverrideAnnotation) typeResource.addAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((AssociationOverrideAnnotation) typeResource.addAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((AssociationOverrideAnnotation) typeResource.addAnnotation(2, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME)).setName("BAZ");
+ ((AssociationOverrideAnnotation) resourceType.addAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME)).setName("FOO");
+ ((AssociationOverrideAnnotation) resourceType.addAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME)).setName("BAR");
+ ((AssociationOverrideAnnotation) resourceType.addAnnotation(2, AssociationOverrideAnnotation.ANNOTATION_NAME)).setName("BAZ");
getJpaProject().synchronizeContextModel();
- ListIterator<JavaAssociationOverride> associationOverrides = overrideContainer.specifiedOverrides();
+ ListIterator<JavaAssociationOverride> associationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("FOO", associationOverrides.next().getName());
assertEquals("BAR", associationOverrides.next().getName());
assertEquals("BAZ", associationOverrides.next().getName());
assertFalse(associationOverrides.hasNext());
- typeResource.moveAnnotation(2, 0, AssociationOverridesAnnotation.ANNOTATION_NAME);
+ resourceType.moveAnnotation(2, 0, AssociationOverrideAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- associationOverrides = overrideContainer.specifiedOverrides();
+ associationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAR", associationOverrides.next().getName());
assertEquals("BAZ", associationOverrides.next().getName());
assertEquals("FOO", associationOverrides.next().getName());
assertFalse(associationOverrides.hasNext());
- typeResource.moveAnnotation(0, 1, AssociationOverridesAnnotation.ANNOTATION_NAME);
+ resourceType.moveAnnotation(0, 1, AssociationOverrideAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- associationOverrides = overrideContainer.specifiedOverrides();
+ associationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", associationOverrides.next().getName());
assertEquals("BAR", associationOverrides.next().getName());
assertEquals("FOO", associationOverrides.next().getName());
assertFalse(associationOverrides.hasNext());
- typeResource.removeAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- associationOverrides = overrideContainer.specifiedOverrides();
+ associationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", associationOverrides.next().getName());
assertEquals("FOO", associationOverrides.next().getName());
assertFalse(associationOverrides.hasNext());
- typeResource.removeAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(1, AssociationOverrideAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- associationOverrides = overrideContainer.specifiedOverrides();
+ associationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertEquals("BAZ", associationOverrides.next().getName());
assertFalse(associationOverrides.hasNext());
- typeResource.removeAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME, AssociationOverridesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(0, AssociationOverrideAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- associationOverrides = overrideContainer.specifiedOverrides();
+ associationOverrides = overrideContainer.getSpecifiedOverrides().iterator();
assertFalse(associationOverrides.hasNext());
}
@@ -2798,7 +2784,7 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaAssociationOverrideContainer overrideContainer = getJavaEntity().getAssociationOverrideContainer();
- ListIterator<JavaVirtualAssociationOverride> virtualAssociationOverrides = overrideContainer.virtualOverrides();
+ ListIterator<JavaVirtualAssociationOverride> virtualAssociationOverrides = overrideContainer.getVirtualOverrides().iterator();
JavaVirtualAssociationOverride virtualAssociationOverride = virtualAssociationOverrides.next();
assertEquals("oneToOne", virtualAssociationOverride.getName());
assertTrue(virtualAssociationOverride.isVirtual());
@@ -2808,12 +2794,12 @@ public class JavaEntityTests extends ContextModelTestCase
assertTrue(virtualAssociationOverride.isVirtual());
assertFalse(virtualAssociationOverrides.hasNext());
- overrideContainer.virtualOverrides().next().convertToSpecified();
- AssociationOverride specifiedAssociationOverride = overrideContainer.specifiedOverrides().next();
+ overrideContainer.getVirtualOverrides().iterator().next().convertToSpecified();
+ AssociationOverride specifiedAssociationOverride = overrideContainer.getSpecifiedOverrides().iterator().next();
assertFalse(specifiedAssociationOverride.isVirtual());
- virtualAssociationOverrides = overrideContainer.virtualOverrides();
+ virtualAssociationOverrides = overrideContainer.getVirtualOverrides().iterator();
virtualAssociationOverride = virtualAssociationOverrides.next();
assertEquals("manyToOne", virtualAssociationOverride.getName());
assertTrue(virtualAssociationOverride.isVirtual());
@@ -2825,35 +2811,35 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
NamedQuery namedQuery1 = entity.getQueryContainer().addNamedQuery(0);
namedQuery1.setName("FOO");
- Iterator<NestableAnnotation> javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> javaNamedQueries = resourceType.getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
NamedQuery namedQuery2 = entity.getQueryContainer().addNamedQuery(0);
namedQuery2.setName("BAR");
- javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
NamedQuery namedQuery3 = entity.getQueryContainer().addNamedQuery(1);
namedQuery3.setName("BAZ");
- javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
- ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().namedQueries();
+ ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().getNamedQueries().iterator();
assertEquals(namedQuery2, namedQueries.next());
assertEquals(namedQuery3, namedQueries.next());
assertEquals(namedQuery1, namedQueries.next());
- namedQueries = entity.getQueryContainer().namedQueries();
+ namedQueries = entity.getQueryContainer().getNamedQueries().iterator();
assertEquals("BAR", namedQueries.next().getName());
assertEquals("BAZ", namedQueries.next().getName());
assertEquals("FOO", namedQueries.next().getName());
@@ -2866,7 +2852,7 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- assertEquals(1, entity.getQueryContainer().namedQueriesSize());
+ assertEquals(1, entity.getQueryContainer().getNamedQueriesSize());
}
public void testRemoveNamedQuery() throws Exception {
@@ -2874,30 +2860,30 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
entity.getQueryContainer().addNamedQuery(0).setName("FOO");
entity.getQueryContainer().addNamedQuery(1).setName("BAR");
entity.getQueryContainer().addNamedQuery(2).setName("BAZ");
- Iterator<NestableAnnotation> javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> javaNamedQueries = resourceType.getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals(3, CollectionTools.size(javaNamedQueries));
entity.getQueryContainer().removeNamedQuery(0);
- javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals(2, CollectionTools.size(javaNamedQueries));
- javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
entity.getQueryContainer().removeNamedQuery(0);
- javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals(1, CollectionTools.size(javaNamedQueries));
- javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
entity.getQueryContainer().removeNamedQuery(0);
- javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals(0, CollectionTools.size(javaNamedQueries));
}
@@ -2906,17 +2892,17 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
entity.getQueryContainer().addNamedQuery(0).setName("FOO");
- NamedNativeQueryAnnotation nativeQuery = (NamedNativeQueryAnnotation) typeResource.addAnnotation(0, JPA.NAMED_NATIVE_QUERY, JPA.NAMED_NATIVE_QUERIES);
+ NamedNativeQueryAnnotation nativeQuery = (NamedNativeQueryAnnotation) resourceType.addAnnotation(0, JPA.NAMED_NATIVE_QUERY);
nativeQuery.setName("BAR");
getJpaProject().synchronizeContextModel();
- assertEquals(1, entity.getQueryContainer().namedNativeQueriesSize());
- ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().namedNativeQueries();
+ assertEquals(1, entity.getQueryContainer().getNamedNativeQueriesSize());
+ ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().getNamedNativeQueries().iterator();
assertEquals("BAR", namedQueries.next().getName());
}
@@ -2925,17 +2911,17 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
entity.getQueryContainer().addNamedNativeQuery(0).setName("FOO");
- NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) typeResource.addAnnotation(0, JPA.NAMED_QUERY, JPA.NAMED_QUERIES);
+ NamedQueryAnnotation namedQuery = (NamedQueryAnnotation) resourceType.addAnnotation(0, JPA.NAMED_QUERY);
namedQuery.setName("BAR");
getJpaProject().synchronizeContextModel();
- assertEquals(1, entity.getQueryContainer().namedQueriesSize());
- ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().namedQueries();
+ assertEquals(1, entity.getQueryContainer().getNamedQueriesSize());
+ ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().getNamedQueries().iterator();
assertEquals("BAR", namedQueries.next().getName());
}
@@ -2944,35 +2930,35 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
entity.getQueryContainer().addNamedQuery(0).setName("FOO");
entity.getQueryContainer().addNamedQuery(1).setName("BAR");
entity.getQueryContainer().addNamedQuery(2).setName("BAZ");
- Iterator<NestableAnnotation> javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> javaNamedQueries = resourceType.getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals(3, CollectionTools.size(javaNamedQueries));
entity.getQueryContainer().moveNamedQuery(2, 0);
- ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().namedQueries();
+ ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().getNamedQueries().iterator();
assertEquals("BAR", namedQueries.next().getName());
assertEquals("BAZ", namedQueries.next().getName());
assertEquals("FOO", namedQueries.next().getName());
- javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
entity.getQueryContainer().moveNamedQuery(0, 1);
- namedQueries = entity.getQueryContainer().namedQueries();
+ namedQueries = entity.getQueryContainer().getNamedQueries().iterator();
assertEquals("BAZ", namedQueries.next().getName());
assertEquals("BAR", namedQueries.next().getName());
assertEquals("FOO", namedQueries.next().getName());
- javaNamedQueries = typeResource.annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAZ", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("BAR", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("FOO", ((NamedQueryAnnotation) javaNamedQueries.next()).getName());
@@ -2983,57 +2969,57 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- assertEquals(0, entity.getPersistenceUnit().queriesSize());
+ assertEquals(0, entity.getPersistenceUnit().getQueriesSize());
- ((NamedQueryAnnotation) typeResource.addAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((NamedQueryAnnotation) typeResource.addAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((NamedQueryAnnotation) typeResource.addAnnotation(2, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ");
+ ((NamedQueryAnnotation) resourceType.addAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME)).setName("FOO");
+ ((NamedQueryAnnotation) resourceType.addAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME)).setName("BAR");
+ ((NamedQueryAnnotation) resourceType.addAnnotation(2, NamedQueryAnnotation.ANNOTATION_NAME)).setName("BAZ");
getJpaProject().synchronizeContextModel();
- ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().namedQueries();
+ ListIterator<JavaNamedQuery> namedQueries = entity.getQueryContainer().getNamedQueries().iterator();
assertEquals("FOO", namedQueries.next().getName());
assertEquals("BAR", namedQueries.next().getName());
assertEquals("BAZ", namedQueries.next().getName());
assertFalse(namedQueries.hasNext());
- assertEquals(3, entity.getPersistenceUnit().queriesSize());
+ assertEquals(3, entity.getPersistenceUnit().getQueriesSize());
- typeResource.moveAnnotation(2, 0, NamedQueriesAnnotation.ANNOTATION_NAME);
+ resourceType.moveAnnotation(2, 0, NamedQueryAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- namedQueries = entity.getQueryContainer().namedQueries();
+ namedQueries = entity.getQueryContainer().getNamedQueries().iterator();
assertEquals("BAR", namedQueries.next().getName());
assertEquals("BAZ", namedQueries.next().getName());
assertEquals("FOO", namedQueries.next().getName());
assertFalse(namedQueries.hasNext());
- typeResource.moveAnnotation(0, 1, NamedQueriesAnnotation.ANNOTATION_NAME);
+ resourceType.moveAnnotation(0, 1, NamedQueryAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- namedQueries = entity.getQueryContainer().namedQueries();
+ namedQueries = entity.getQueryContainer().getNamedQueries().iterator();
assertEquals("BAZ", namedQueries.next().getName());
assertEquals("BAR", namedQueries.next().getName());
assertEquals("FOO", namedQueries.next().getName());
assertFalse(namedQueries.hasNext());
- typeResource.removeAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- namedQueries = entity.getQueryContainer().namedQueries();
+ namedQueries = entity.getQueryContainer().getNamedQueries().iterator();
assertEquals("BAZ", namedQueries.next().getName());
assertEquals("FOO", namedQueries.next().getName());
assertFalse(namedQueries.hasNext());
- assertEquals(2, entity.getPersistenceUnit().queriesSize());
+ assertEquals(2, entity.getPersistenceUnit().getQueriesSize());
- typeResource.removeAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- namedQueries = entity.getQueryContainer().namedQueries();
+ namedQueries = entity.getQueryContainer().getNamedQueries().iterator();
assertEquals("BAZ", namedQueries.next().getName());
assertFalse(namedQueries.hasNext());
- assertEquals(1, entity.getPersistenceUnit().queriesSize());
+ assertEquals(1, entity.getPersistenceUnit().getQueriesSize());
- typeResource.removeAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- namedQueries = entity.getQueryContainer().namedQueries();
+ namedQueries = entity.getQueryContainer().getNamedQueries().iterator();
assertFalse(namedQueries.hasNext());
- assertEquals(0, entity.getPersistenceUnit().queriesSize());
+ assertEquals(0, entity.getPersistenceUnit().getQueriesSize());
}
public void testNamedQueriesSize() throws Exception {
@@ -3041,16 +3027,16 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- assertEquals(0, entity.getQueryContainer().namedQueriesSize());
+ assertEquals(0, entity.getQueryContainer().getNamedQueriesSize());
- ((NamedQueryAnnotation) typeResource.addAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((NamedQueryAnnotation) typeResource.addAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((NamedQueryAnnotation) typeResource.addAnnotation(2, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ");
+ ((NamedQueryAnnotation) resourceType.addAnnotation(0, NamedQueryAnnotation.ANNOTATION_NAME)).setName("FOO");
+ ((NamedQueryAnnotation) resourceType.addAnnotation(1, NamedQueryAnnotation.ANNOTATION_NAME)).setName("BAR");
+ ((NamedQueryAnnotation) resourceType.addAnnotation(2, NamedQueryAnnotation.ANNOTATION_NAME)).setName("BAZ");
getJpaProject().synchronizeContextModel();
- assertEquals(3, entity.getQueryContainer().namedQueriesSize());
+ assertEquals(3, entity.getQueryContainer().getNamedQueriesSize());
}
public void testAddNamedNativeQuery() throws Exception {
@@ -3058,35 +3044,35 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
NamedNativeQuery namedNativeQuery = entity.getQueryContainer().addNamedNativeQuery(0);
namedNativeQuery.setName("FOO");
- Iterator<NestableAnnotation> javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> javaNamedQueries = resourceType.getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
NamedNativeQuery namedNativeQuery2 = entity.getQueryContainer().addNamedNativeQuery(0);
namedNativeQuery2.setName("BAR");
- javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
NamedNativeQuery namedNativeQuery3 = entity.getQueryContainer().addNamedNativeQuery(1);
namedNativeQuery3.setName("BAZ");
- javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
- ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().namedNativeQueries();
+ ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().getNamedNativeQueries().iterator();
assertEquals(namedNativeQuery2, namedQueries.next());
assertEquals(namedNativeQuery3, namedQueries.next());
assertEquals(namedNativeQuery, namedQueries.next());
- namedQueries = entity.getQueryContainer().namedNativeQueries();
+ namedQueries = entity.getQueryContainer().getNamedNativeQueries().iterator();
assertEquals("BAR", namedQueries.next().getName());
assertEquals("BAZ", namedQueries.next().getName());
assertEquals("FOO", namedQueries.next().getName());
@@ -3097,30 +3083,30 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
entity.getQueryContainer().addNamedNativeQuery(0).setName("FOO");
entity.getQueryContainer().addNamedNativeQuery(1).setName("BAR");
entity.getQueryContainer().addNamedNativeQuery(2).setName("BAZ");
- Iterator<NestableAnnotation> javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> javaNamedQueries = resourceType.getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals(3, CollectionTools.size(javaNamedQueries));
entity.getQueryContainer().removeNamedNativeQuery(0);
- javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals(2, CollectionTools.size(javaNamedQueries));
- javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
entity.getQueryContainer().removeNamedNativeQuery(0);
- javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals(1, CollectionTools.size(javaNamedQueries));
- javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
entity.getQueryContainer().removeNamedNativeQuery(0);
- javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals(0, CollectionTools.size(javaNamedQueries));
}
@@ -3129,34 +3115,34 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
entity.getQueryContainer().addNamedNativeQuery(0).setName("FOO");
entity.getQueryContainer().addNamedNativeQuery(1).setName("BAR");
entity.getQueryContainer().addNamedNativeQuery(2).setName("BAZ");
- Iterator<NestableAnnotation> javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ Iterator<NestableAnnotation> javaNamedQueries = resourceType.getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals(3, CollectionTools.size(javaNamedQueries));
entity.getQueryContainer().moveNamedNativeQuery(2, 0);
- ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().namedNativeQueries();
+ ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().getNamedNativeQueries().iterator();
assertEquals("BAR", namedQueries.next().getName());
assertEquals("BAZ", namedQueries.next().getName());
assertEquals("FOO", namedQueries.next().getName());
- javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
entity.getQueryContainer().moveNamedNativeQuery(0, 1);
- namedQueries = entity.getQueryContainer().namedNativeQueries();
+ namedQueries = entity.getQueryContainer().getNamedNativeQueries().iterator();
assertEquals("BAZ", namedQueries.next().getName());
assertEquals("BAR", namedQueries.next().getName());
assertEquals("FOO", namedQueries.next().getName());
- javaNamedQueries = typeResource.annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ javaNamedQueries = resourceType.getAnnotations(NamedNativeQueryAnnotation.ANNOTATION_NAME).iterator();
assertEquals("BAZ", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("BAR", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
assertEquals("FOO", ((NamedNativeQueryAnnotation) javaNamedQueries.next()).getName());
@@ -3167,57 +3153,57 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- assertEquals(0, entity.getPersistenceUnit().queriesSize());
+ assertEquals(0, entity.getPersistenceUnit().getQueriesSize());
- ((NamedNativeQueryAnnotation) typeResource.addAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((NamedNativeQueryAnnotation) typeResource.addAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((NamedNativeQueryAnnotation) typeResource.addAnnotation(2, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ");
+ ((NamedNativeQueryAnnotation) resourceType.addAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME)).setName("FOO");
+ ((NamedNativeQueryAnnotation) resourceType.addAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME)).setName("BAR");
+ ((NamedNativeQueryAnnotation) resourceType.addAnnotation(2, NamedNativeQueryAnnotation.ANNOTATION_NAME)).setName("BAZ");
getJpaProject().synchronizeContextModel();
- ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().namedNativeQueries();
+ ListIterator<JavaNamedNativeQuery> namedQueries = entity.getQueryContainer().getNamedNativeQueries().iterator();
assertEquals("FOO", namedQueries.next().getName());
assertEquals("BAR", namedQueries.next().getName());
assertEquals("BAZ", namedQueries.next().getName());
assertFalse(namedQueries.hasNext());
- assertEquals(3, entity.getPersistenceUnit().queriesSize());
+ assertEquals(3, entity.getPersistenceUnit().getQueriesSize());
- typeResource.moveAnnotation(2, 0, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ resourceType.moveAnnotation(2, 0, NamedNativeQueryAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- namedQueries = entity.getQueryContainer().namedNativeQueries();
+ namedQueries = entity.getQueryContainer().getNamedNativeQueries().iterator();
assertEquals("BAR", namedQueries.next().getName());
assertEquals("BAZ", namedQueries.next().getName());
assertEquals("FOO", namedQueries.next().getName());
assertFalse(namedQueries.hasNext());
- typeResource.moveAnnotation(0, 1, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ resourceType.moveAnnotation(0, 1, NamedNativeQueryAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- namedQueries = entity.getQueryContainer().namedNativeQueries();
+ namedQueries = entity.getQueryContainer().getNamedNativeQueries().iterator();
assertEquals("BAZ", namedQueries.next().getName());
assertEquals("BAR", namedQueries.next().getName());
assertEquals("FOO", namedQueries.next().getName());
assertFalse(namedQueries.hasNext());
- typeResource.removeAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- namedQueries = entity.getQueryContainer().namedNativeQueries();
+ namedQueries = entity.getQueryContainer().getNamedNativeQueries().iterator();
assertEquals("BAZ", namedQueries.next().getName());
assertEquals("FOO", namedQueries.next().getName());
assertFalse(namedQueries.hasNext());
- assertEquals(2, entity.getPersistenceUnit().queriesSize());
+ assertEquals(2, entity.getPersistenceUnit().getQueriesSize());
- typeResource.removeAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- namedQueries = entity.getQueryContainer().namedNativeQueries();
+ namedQueries = entity.getQueryContainer().getNamedNativeQueries().iterator();
assertEquals("BAZ", namedQueries.next().getName());
assertFalse(namedQueries.hasNext());
- assertEquals(1, entity.getPersistenceUnit().queriesSize());
+ assertEquals(1, entity.getPersistenceUnit().getQueriesSize());
- typeResource.removeAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
- namedQueries = entity.getQueryContainer().namedNativeQueries();
+ namedQueries = entity.getQueryContainer().getNamedNativeQueries().iterator();
assertFalse(namedQueries.hasNext());
- assertEquals(0, entity.getPersistenceUnit().queriesSize());
+ assertEquals(0, entity.getPersistenceUnit().getQueriesSize());
}
public void testNamedNativeQueriesSize() throws Exception {
@@ -3225,16 +3211,16 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
JavaEntity entity = getJavaEntity();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
- assertEquals(0, entity.getQueryContainer().namedNativeQueriesSize());
+ assertEquals(0, entity.getQueryContainer().getNamedNativeQueriesSize());
- ((NamedNativeQueryAnnotation) typeResource.addAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("FOO");
- ((NamedNativeQueryAnnotation) typeResource.addAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAR");
- ((NamedNativeQueryAnnotation) typeResource.addAnnotation(2, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME)).setName("BAZ");
+ ((NamedNativeQueryAnnotation) resourceType.addAnnotation(0, NamedNativeQueryAnnotation.ANNOTATION_NAME)).setName("FOO");
+ ((NamedNativeQueryAnnotation) resourceType.addAnnotation(1, NamedNativeQueryAnnotation.ANNOTATION_NAME)).setName("BAR");
+ ((NamedNativeQueryAnnotation) resourceType.addAnnotation(2, NamedNativeQueryAnnotation.ANNOTATION_NAME)).setName("BAZ");
getJpaProject().synchronizeContextModel();
- assertEquals(3, entity.getQueryContainer().namedNativeQueriesSize());
+ assertEquals(3, entity.getQueryContainer().getNamedNativeQueriesSize());
}
public void testUpdateIdClass() throws Exception {
@@ -3242,23 +3228,23 @@ public class JavaEntityTests extends ContextModelTestCase
createTestIdClass();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
assertNull(getJavaEntity().getIdClassReference().getSpecifiedIdClassName());
assertNull(getJavaEntity().getIdClassReference().getIdClass());
- assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
- IdClassAnnotation idClassAnnotation = (IdClassAnnotation) typeResource.addAnnotation(IdClassAnnotation.ANNOTATION_NAME);
+ IdClassAnnotation idClassAnnotation = (IdClassAnnotation) resourceType.addAnnotation(IdClassAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
assertNull(getJavaEntity().getIdClassReference().getSpecifiedIdClassName());
- assertNotNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceType.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
// test setting id class name to nonexistent class. test class name is set, but class is null
String nonExistentIdClassName = PACKAGE_NAME + ".Foo";
idClassAnnotation.setValue(nonExistentIdClassName);
getJpaProject().synchronizeContextModel();
assertEquals(nonExistentIdClassName, getJavaEntity().getIdClassReference().getSpecifiedIdClassName());
- assertEquals(nonExistentIdClassName, ((IdClassAnnotation) typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue());
+ assertEquals(nonExistentIdClassName, ((IdClassAnnotation) resourceType.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue());
assertNull(getJavaEntity().getIdClassReference().getIdClass());
// test setting id class name to existent class. test class name is set and class is not null
@@ -3266,7 +3252,7 @@ public class JavaEntityTests extends ContextModelTestCase
idClassAnnotation.setValue(existentIdClassName);
getJpaProject().synchronizeContextModel();
assertEquals(existentIdClassName, getJavaEntity().getIdClassReference().getSpecifiedIdClassName());
- assertEquals(existentIdClassName, ((IdClassAnnotation) typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue());
+ assertEquals(existentIdClassName, ((IdClassAnnotation) resourceType.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue());
assertNotNull(getJavaEntity().getIdClassReference().getIdClass());
//test setting @IdClass value to null
@@ -3276,12 +3262,12 @@ public class JavaEntityTests extends ContextModelTestCase
assertNull(getJavaEntity().getIdClassReference().getIdClass());
//reset @IdClass value and then remove @IdClass
- idClassAnnotation = (IdClassAnnotation) typeResource.addAnnotation(IdClassAnnotation.ANNOTATION_NAME);
+ idClassAnnotation = (IdClassAnnotation) resourceType.addAnnotation(IdClassAnnotation.ANNOTATION_NAME);
idClassAnnotation.setValue(existentIdClassName);
- typeResource.removeAnnotation(IdClassAnnotation.ANNOTATION_NAME);
+ resourceType.removeAnnotation(IdClassAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
assertNull(getJavaEntity().getIdClassReference().getSpecifiedIdClassName());
- assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
assertNull(getJavaEntity().getIdClassReference().getIdClass());
}
@@ -3290,27 +3276,27 @@ public class JavaEntityTests extends ContextModelTestCase
createTestIdClass();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
-
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+
assertNull(getJavaEntity().getIdClassReference().getSpecifiedIdClassName());
- assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
assertNull(getJavaEntity().getIdClassReference().getIdClass());
String nonExistentIdClassName = PACKAGE_NAME_ + "Foo";
getJavaEntity().getIdClassReference().setSpecifiedIdClassName(nonExistentIdClassName);
- assertEquals(nonExistentIdClassName, ((IdClassAnnotation) typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue());
+ assertEquals(nonExistentIdClassName, ((IdClassAnnotation) resourceType.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue());
assertEquals(nonExistentIdClassName, getJavaEntity().getIdClassReference().getSpecifiedIdClassName());
assertNull(getJavaEntity().getIdClassReference().getIdClass());
String existentIdClassName = PACKAGE_NAME_ + "TestTypeId";
getJavaEntity().getIdClassReference().setSpecifiedIdClassName(existentIdClassName);
- assertEquals(existentIdClassName, ((IdClassAnnotation) typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue());
+ assertEquals(existentIdClassName, ((IdClassAnnotation) resourceType.getAnnotation(IdClassAnnotation.ANNOTATION_NAME)).getValue());
assertEquals(existentIdClassName, getJavaEntity().getIdClassReference().getSpecifiedIdClassName());
assertNotNull(getJavaEntity().getIdClassReference().getIdClass());
getJavaEntity().getIdClassReference().setSpecifiedIdClassName(null);
assertNull(getJavaEntity().getIdClassReference().getSpecifiedIdClassName());
- assertNull(typeResource.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
+ assertNull(resourceType.getAnnotation(IdClassAnnotation.ANNOTATION_NAME));
assertNull(getJavaEntity().getIdClassReference().getIdClass());
}
@@ -3320,7 +3306,7 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- Iterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ Iterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
JavaPersistentType entityPersistentType = classRefs.next().getJavaPersistentType();
JavaEntity javaEntity = (JavaEntity) entityPersistentType.getMapping();
JavaPersistentType mappedSuperclassPersistentType = classRefs.next().getJavaPersistentType();
@@ -3330,7 +3316,7 @@ public class JavaEntityTests extends ContextModelTestCase
((JavaIdMapping) mappedSuperclassPersistentType.getAttributeNamed("id").getMapping()).getColumn().setSpecifiedName("MY_ID");
assertEquals("MY_ID", javaEntity.getPrimaryKeyColumnName());
- ListIterator<JavaVirtualAttributeOverride> virtualAttributeOverrides = javaEntity.getAttributeOverrideContainer().virtualOverrides();
+ ListIterator<JavaVirtualAttributeOverride> virtualAttributeOverrides = javaEntity.getAttributeOverrideContainer().getVirtualOverrides().iterator();
virtualAttributeOverrides.next();
virtualAttributeOverrides.next();
JavaVirtualAttributeOverride virtualOverride = virtualAttributeOverrides.next();
@@ -3366,7 +3352,7 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
Entity concreteEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
assertEquals("AnnotationTestTypeChild", concreteEntity.getName());
@@ -3391,7 +3377,7 @@ public class JavaEntityTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".AnnotationTestTypeChild");
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> specifiedClassRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
Entity concreteEntity = (Entity) specifiedClassRefs.next().getJavaPersistentType().getMapping();
assertEquals("AnnotationTestTypeChild", concreteEntity.getName());
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaGeneratedValueTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaGeneratedValueTests.java
index f904a0353d..3df675ec4b 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaGeneratedValueTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaGeneratedValueTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -12,14 +12,15 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.context.GeneratedValue;
import org.eclipse.jpt.jpa.core.context.GenerationType;
import org.eclipse.jpt.jpa.core.context.IdMapping;
import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@SuppressWarnings("nls")
@@ -58,9 +59,9 @@ public class JavaGeneratedValueTests extends ContextModelTestCase
assertEquals(GENERATOR, idMapping.getGeneratedValue().getGenerator());
//change resource model sequenceGenerator name, verify the context model is updated
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) resourceField.getAnnotation(JPA.GENERATED_VALUE);
generatedValue.setGenerator("foo");
getJpaProject().synchronizeContextModel();
@@ -79,9 +80,9 @@ public class JavaGeneratedValueTests extends ContextModelTestCase
assertEquals("foo", idMapping.getGeneratedValue().getGenerator());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) resourceField.getAnnotation(JPA.GENERATED_VALUE);
assertEquals("foo", generatedValue.getGenerator());
}
@@ -97,9 +98,9 @@ public class JavaGeneratedValueTests extends ContextModelTestCase
assertNotNull(idMapping.getGeneratedValue());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) resourceField.getAnnotation(JPA.GENERATED_VALUE);
assertNotNull(generatedValue);
}
@@ -112,9 +113,9 @@ public class JavaGeneratedValueTests extends ContextModelTestCase
assertEquals(GeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy());
//change resource model sequenceGenerator name, verify the context model is updated
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) resourceField.getAnnotation(JPA.GENERATED_VALUE);
generatedValue.setStrategy(org.eclipse.jpt.jpa.core.resource.java.GenerationType.IDENTITY);
getJpaProject().synchronizeContextModel();
@@ -134,16 +135,16 @@ public class JavaGeneratedValueTests extends ContextModelTestCase
assertEquals(GenerationType.IDENTITY, idMapping.getGeneratedValue().getStrategy());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ GeneratedValueAnnotation generatedValue = (GeneratedValueAnnotation) resourceField.getAnnotation(JPA.GENERATED_VALUE);
assertEquals(org.eclipse.jpt.jpa.core.resource.java.GenerationType.IDENTITY, generatedValue.getStrategy());
idMapping.getGeneratedValue().setSpecifiedStrategy(null);
assertEquals(GeneratedValue.DEFAULT_STRATEGY, idMapping.getGeneratedValue().getStrategy());
- generatedValue = (GeneratedValueAnnotation) attributeResource.getAnnotation(JPA.GENERATED_VALUE);
+ generatedValue = (GeneratedValueAnnotation) resourceField.getAnnotation(JPA.GENERATED_VALUE);
assertNotNull(generatedValue);
assertNull(generatedValue.getStrategy());
}
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaIdMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaIdMappingTests.java
index d756109f2d..38c7d85056 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaIdMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaIdMappingTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2007, 2011 Oracle. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0, which accompanies this distribution
* and is available at http://www.eclipse.org/legal/epl-v10.html.
@@ -11,6 +11,9 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.BasicMapping;
@@ -33,8 +36,6 @@ import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation;
@@ -114,7 +115,7 @@ public class JavaIdMappingTests extends ContextModelTestCase
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
@@ -129,22 +130,22 @@ public class JavaIdMappingTests extends ContextModelTestCase
assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
assertEquals(TemporalType.TIME, ((TemporalConverter) ((BasicMapping) persistentAttribute.getMapping()).getConverter()).getTemporalType());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
}
public void testMorphToDefault() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
@@ -159,21 +160,21 @@ public class JavaIdMappingTests extends ContextModelTestCase
assertEquals("FOO", ((BasicMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
assertEquals(TemporalType.TIME, ((TemporalConverter) ((BasicMapping) persistentAttribute.getMapping()).getConverter()).getTemporalType());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
}
public void testMorphToVersionMapping() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
@@ -188,22 +189,22 @@ public class JavaIdMappingTests extends ContextModelTestCase
assertEquals("FOO", ((VersionMapping) persistentAttribute.getMapping()).getColumn().getSpecifiedName());
assertEquals(TemporalType.TIME, ((TemporalConverter) ((VersionMapping) persistentAttribute.getMapping()).getConverter()).getTemporalType());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(VersionAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
}
public void testMorphToEmbeddedMapping() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
@@ -217,22 +218,22 @@ public class JavaIdMappingTests extends ContextModelTestCase
persistentAttribute.setMappingKey(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
}
public void testMorphToTransientMapping() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
@@ -246,22 +247,22 @@ public class JavaIdMappingTests extends ContextModelTestCase
persistentAttribute.setMappingKey(MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(TransientAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
}
public void testMorphToEmbeddedIdMapping() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
@@ -275,22 +276,22 @@ public class JavaIdMappingTests extends ContextModelTestCase
persistentAttribute.setMappingKey(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
}
public void testMorphToOneToOneMapping() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
@@ -304,22 +305,22 @@ public class JavaIdMappingTests extends ContextModelTestCase
persistentAttribute.setMappingKey(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
}
public void testMorphToOneToManyMapping() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
@@ -333,22 +334,22 @@ public class JavaIdMappingTests extends ContextModelTestCase
persistentAttribute.setMappingKey(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
}
public void testMorphToManyToOneMapping() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
@@ -362,22 +363,22 @@ public class JavaIdMappingTests extends ContextModelTestCase
persistentAttribute.setMappingKey(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
}
public void testMorphToManyToManyMapping() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertFalse(idMapping.isDefault());
idMapping.getColumn().setSpecifiedName("FOO");
@@ -391,22 +392,22 @@ public class JavaIdMappingTests extends ContextModelTestCase
persistentAttribute.setMappingKey(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping() instanceof ManyToManyMapping);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
}
public void testGetTemporal() throws Exception {
createTestEntityWithTemporal();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertEquals(TemporalType.TIMESTAMP, ((TemporalConverter) idMapping.getConverter()).getTemporalType());
@@ -416,42 +417,42 @@ public class JavaIdMappingTests extends ContextModelTestCase
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertNull(idMapping.getConverter().getType());
idMapping.setConverter(TemporalConverter.class);
((TemporalConverter) idMapping.getConverter()).setTemporalType(TemporalType.TIME);
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ TemporalAnnotation temporal = (TemporalAnnotation) resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME);
assertEquals(org.eclipse.jpt.jpa.core.resource.java.TemporalType.TIME, temporal.getValue());
idMapping.setConverter(null);
- assertNull(attributeResource.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
}
public void testGetTemporalUpdatesFromResourceModelChange() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertNull(idMapping.getConverter().getType());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- TemporalAnnotation temporal = (TemporalAnnotation) attributeResource.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ TemporalAnnotation temporal = (TemporalAnnotation) resourceField.addAnnotation(TemporalAnnotation.ANNOTATION_NAME);
temporal.setValue(org.eclipse.jpt.jpa.core.resource.java.TemporalType.DATE);
getJpaProject().synchronizeContextModel();
assertEquals(TemporalType.DATE, ((TemporalConverter) idMapping.getConverter()).getTemporalType());
- attributeResource.removeAnnotation(TemporalAnnotation.ANNOTATION_NAME);
+ resourceField.removeAnnotation(TemporalAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
assertNull(idMapping.getConverter().getType());
@@ -463,15 +464,15 @@ public class JavaIdMappingTests extends ContextModelTestCase
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertNull(idMapping.getColumn().getSpecifiedName());
assertEquals("id", idMapping.getColumn().getName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ColumnAnnotation column = (ColumnAnnotation) attributeResource.addAnnotation(JPA.COLUMN);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ColumnAnnotation column = (ColumnAnnotation) resourceField.addAnnotation(JPA.COLUMN);
column.setName("foo");
getJpaProject().synchronizeContextModel();
@@ -484,39 +485,39 @@ public class JavaIdMappingTests extends ContextModelTestCase
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertNull(idMapping.getGeneratorContainer().getSequenceGenerator());
- assertEquals(0, idMapping.getPersistenceUnit().generatorsSize());
+ assertEquals(0, idMapping.getPersistenceUnit().getGeneratorsSize());
- JavaResourcePersistentType resourceType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute resourceAttribute = resourceType.persistableAttributes().next();
- resourceAttribute.addAnnotation(JPA.SEQUENCE_GENERATOR);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(JPA.SEQUENCE_GENERATOR);
getJpaProject().synchronizeContextModel();
assertNotNull(idMapping.getGeneratorContainer().getSequenceGenerator());
- assertEquals(2, resourceAttribute.annotationsSize());
- assertEquals(1, idMapping.getPersistenceUnit().generatorsSize());
+ assertEquals(2, resourceField.getAnnotationsSize());
+ assertEquals(1, idMapping.getPersistenceUnit().getGeneratorsSize());
idMapping.getGeneratorContainer().getSequenceGenerator().setName("foo");
getJpaProject().synchronizeContextModel();
- assertEquals(1, idMapping.getPersistenceUnit().generatorsSize());
+ assertEquals(1, idMapping.getPersistenceUnit().getGeneratorsSize());
}
public void testAddSequenceGenerator() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertNull(idMapping.getGeneratorContainer().getSequenceGenerator());
idMapping.getGeneratorContainer().addSequenceGenerator();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- assertNotNull(attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR));
+ assertNotNull(resourceField.getAnnotation(JPA.SEQUENCE_GENERATOR));
assertNotNull(idMapping.getGeneratorContainer().getSequenceGenerator());
//try adding another sequence generator, should get an IllegalStateException
@@ -532,19 +533,19 @@ public class JavaIdMappingTests extends ContextModelTestCase
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(JPA.SEQUENCE_GENERATOR);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(JPA.SEQUENCE_GENERATOR);
getJpaProject().synchronizeContextModel();
idMapping.getGeneratorContainer().removeSequenceGenerator();
assertNull(idMapping.getGeneratorContainer().getSequenceGenerator());
- assertNull(attributeResource.getAnnotation(JPA.SEQUENCE_GENERATOR));
+ assertNull(resourceField.getAnnotation(JPA.SEQUENCE_GENERATOR));
//try removing the sequence generator again, should get an IllegalStateException
try {
@@ -559,38 +560,38 @@ public class JavaIdMappingTests extends ContextModelTestCase
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertNull(idMapping.getGeneratorContainer().getTableGenerator());
- assertEquals(0, idMapping.getPersistenceUnit().generatorsSize());
+ assertEquals(0, idMapping.getPersistenceUnit().getGeneratorsSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(JPA.TABLE_GENERATOR);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(JPA.TABLE_GENERATOR);
getJpaProject().synchronizeContextModel();
assertNotNull(idMapping.getGeneratorContainer().getTableGenerator());
- assertEquals(2, attributeResource.annotationsSize());
- assertEquals(1, idMapping.getPersistenceUnit().generatorsSize());
+ assertEquals(2, resourceField.getAnnotationsSize());
+ assertEquals(1, idMapping.getPersistenceUnit().getGeneratorsSize());
idMapping.getGeneratorContainer().getTableGenerator().setName("foo");
- assertEquals(1, idMapping.getPersistenceUnit().generatorsSize());
+ assertEquals(1, idMapping.getPersistenceUnit().getGeneratorsSize());
}
public void testAddTableGenerator() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertNull(idMapping.getGeneratorContainer().getTableGenerator());
idMapping.getGeneratorContainer().addTableGenerator();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- assertNotNull(attributeResource.getAnnotation(JPA.TABLE_GENERATOR));
+ assertNotNull(resourceField.getAnnotation(JPA.TABLE_GENERATOR));
assertNotNull(idMapping.getGeneratorContainer().getTableGenerator());
//try adding another table generator, should get an IllegalStateException
@@ -606,19 +607,19 @@ public class JavaIdMappingTests extends ContextModelTestCase
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(JPA.TABLE_GENERATOR);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(JPA.TABLE_GENERATOR);
getJpaProject().synchronizeContextModel();
idMapping.getGeneratorContainer().removeTableGenerator();
assertNull(idMapping.getGeneratorContainer().getTableGenerator());
- assertNull(attributeResource.getAnnotation(JPA.TABLE_GENERATOR));
+ assertNull(resourceField.getAnnotation(JPA.TABLE_GENERATOR));
//try removing the table generator again, should get an IllegalStateException
try {
@@ -633,49 +634,49 @@ public class JavaIdMappingTests extends ContextModelTestCase
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertNull(idMapping.getGeneratedValue());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(JPA.GENERATED_VALUE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(JPA.GENERATED_VALUE);
getJpaProject().synchronizeContextModel();
assertNotNull(idMapping.getGeneratedValue());
- assertEquals(2, attributeResource.annotationsSize());
+ assertEquals(2, resourceField.getAnnotationsSize());
}
public void testGetGeneratedValue2() throws Exception {
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
createTestEntityWithIdMappingGeneratedValue();
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
assertNotNull(idMapping.getGeneratedValue());
- assertEquals(2, attributeResource.annotationsSize());
+ assertEquals(2, resourceField.getAnnotationsSize());
}
public void testAddGeneratedValue() throws Exception {
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
assertNull(idMapping.getGeneratedValue());
idMapping.addGeneratedValue();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- assertNotNull(attributeResource.getAnnotation(JPA.GENERATED_VALUE));
+ assertNotNull(resourceField.getAnnotation(JPA.GENERATED_VALUE));
assertNotNull(idMapping.getGeneratedValue());
//try adding another generated value, should get an IllegalStateException
@@ -691,18 +692,18 @@ public class JavaIdMappingTests extends ContextModelTestCase
createTestEntityWithIdMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- attributeResource.addAnnotation(JPA.GENERATED_VALUE);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ resourceField.addAnnotation(JPA.GENERATED_VALUE);
getJpaProject().synchronizeContextModel();
idMapping.removeGeneratedValue();
assertNull(idMapping.getGeneratedValue());
- assertNull(attributeResource.getAnnotation(JPA.GENERATED_VALUE));
+ assertNull(resourceField.getAnnotation(JPA.GENERATED_VALUE));
//try removing the generatedValue again, should get an IllegalStateException
try {
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaJoinColumnTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaJoinColumnTests.java
index 71dd7f285f..e9bdd2a798 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaJoinColumnTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaJoinColumnTests.java
@@ -11,14 +11,15 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn;
import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy;
import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -93,30 +94,30 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType resourceType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute resourceAttribute = resourceType.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinColumnAnnotation joinColumnAnnotation = (JoinColumnAnnotation) resourceAttribute.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation joinColumnAnnotation = (JoinColumnAnnotation) resourceField.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
+ assertEquals(0, joinColumns.getSpecifiedJoinColumnsSize());
assertNull(joinColumnAnnotation);
//set name in the resource model, verify context model updated
- joinColumnAnnotation = (JoinColumnAnnotation) resourceAttribute.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ joinColumnAnnotation = (JoinColumnAnnotation) resourceField.addAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
joinColumnAnnotation.setName("FOO");
getJpaProject().synchronizeContextModel();
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
+ JavaJoinColumn joinColumn = joinColumns.getSpecifiedJoinColumns().iterator().next();
assertEquals("FOO", joinColumn.getSpecifiedName());
assertEquals("FOO", joinColumnAnnotation.getName());
//set name to null, annotation is NOT removed
joinColumn.setSpecifiedName(null);
- assertEquals(1, joinColumns.specifiedJoinColumnsSize());
- joinColumnAnnotation = (JoinColumnAnnotation) resourceAttribute.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ assertEquals(1, joinColumns.getSpecifiedJoinColumnsSize());
+ joinColumnAnnotation = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
assertNull(joinColumnAnnotation.getName());
}
@@ -124,24 +125,24 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType resourceType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute resourceAttribute = resourceType.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
//set name in the context model, verify resource model modified
joinColumn.setSpecifiedName("foo");
- JoinColumnAnnotation joinColumnAnnotation = (JoinColumnAnnotation) resourceAttribute.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation joinColumnAnnotation = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
assertEquals("foo", joinColumn.getSpecifiedName());
assertEquals("foo", joinColumnAnnotation.getName());
//set name to null in the context model
joinColumn.setSpecifiedName(null);
assertNull(joinColumn.getSpecifiedName());
- joinColumnAnnotation = (JoinColumnAnnotation) resourceAttribute.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ joinColumnAnnotation = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
assertNull(joinColumnAnnotation.getName());
}
@@ -165,8 +166,8 @@ public class JavaJoinColumnTests extends ContextModelTestCase
// assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName());
//
// JavaPersistentTypeResource typeResource = jpaProject().javaPersistentTypeResource(FULLY_QUALIFIED_TYPE_NAME);
-// JavaPersistentAttributeResource attributeResource = typeResource.attributes().next();
-// assertNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+// JavaPersistentresourceField resourceField = typeResource.attributes().next();
+// assertNull(resourceField.annotation(JoinTable.ANNOTATION_NAME));
//
// //target entity does not resolve, default name is null
// manyToManyMapping.setSpecifiedTargetEntity("Foo");
@@ -177,9 +178,9 @@ public class JavaJoinColumnTests extends ContextModelTestCase
// assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName());
//
// //add the join table annotation, verify default join table name is the same
-// attributeResource.addAnnotation(JoinTable.ANNOTATION_NAME);
+// resourceField.addAnnotation(JoinTable.ANNOTATION_NAME);
// assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName());
-// assertNotNull(attributeResource.annotation(JoinTable.ANNOTATION_NAME));
+// assertNotNull(resourceField.annotation(JoinTable.ANNOTATION_NAME));
//
// //set a table on the target entity, very default join table name updates
// manyToManyMapping.getResolvedTargetEntity().getTable().setSpecifiedName("FOO");
@@ -194,24 +195,24 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
+ assertEquals(0, joinColumns.getSpecifiedJoinColumnsSize());
assertNull(javaJoinColumn);
//set referenced column name in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ javaJoinColumn = (JoinColumnAnnotation) resourceField.addAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
javaJoinColumn.setName("FOO");
javaJoinColumn.setReferencedColumnName("BAR");
getJpaProject().synchronizeContextModel();
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
+ JavaJoinColumn joinColumn = joinColumns.getSpecifiedJoinColumns().iterator().next();
assertEquals("BAR", joinColumn.getSpecifiedReferencedColumnName());
assertEquals("BAR", javaJoinColumn.getReferencedColumnName());
@@ -226,18 +227,18 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
//set referenced column name in the context model, verify resource model modified
joinColumn.setSpecifiedName("foo");
joinColumn.setSpecifiedReferencedColumnName("BAR");
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
assertEquals("BAR", joinColumn.getSpecifiedReferencedColumnName());
assertEquals("BAR", javaJoinColumn.getReferencedColumnName());
@@ -256,24 +257,24 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
+ assertEquals(0, joinColumns.getSpecifiedJoinColumnsSize());
assertNull(javaJoinColumn);
//set table in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ javaJoinColumn = (JoinColumnAnnotation) resourceField.addAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
javaJoinColumn.setName("FOO");
javaJoinColumn.setTable("BAR");
getJpaProject().synchronizeContextModel();
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
+ JavaJoinColumn joinColumn = joinColumns.getSpecifiedJoinColumns().iterator().next();
assertEquals("BAR", joinColumn.getSpecifiedTable());
assertEquals("BAR", javaJoinColumn.getTable());
@@ -288,11 +289,11 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
@@ -300,7 +301,7 @@ public class JavaJoinColumnTests extends ContextModelTestCase
joinColumn.setSpecifiedName("foo");
joinColumn.setSpecifiedTable("BAR");
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
assertEquals("BAR", joinColumn.getSpecifiedTable());
assertEquals("BAR", javaJoinColumn.getTable());
@@ -319,24 +320,24 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
+ assertEquals(0, joinColumns.getSpecifiedJoinColumnsSize());
assertNull(javaJoinColumn);
//set unique in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ javaJoinColumn = (JoinColumnAnnotation) resourceField.addAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
javaJoinColumn.setName("FOO");
javaJoinColumn.setUnique(Boolean.TRUE);
getJpaProject().synchronizeContextModel();
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
+ JavaJoinColumn joinColumn = joinColumns.getSpecifiedJoinColumns().iterator().next();
assertEquals(Boolean.TRUE, joinColumn.getSpecifiedUnique());
assertEquals(Boolean.TRUE, javaJoinColumn.getUnique());
@@ -351,11 +352,11 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
@@ -363,7 +364,7 @@ public class JavaJoinColumnTests extends ContextModelTestCase
joinColumn.setSpecifiedName("foo");
joinColumn.setSpecifiedUnique(Boolean.TRUE);
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
assertEquals(Boolean.TRUE, joinColumn.getSpecifiedUnique());
assertEquals(Boolean.TRUE, javaJoinColumn.getUnique());
@@ -377,24 +378,24 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) resourceField.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
+ assertEquals(0, joinColumns.getSpecifiedJoinColumnsSize());
assertNull(javaJoinColumn);
//set nullable in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ javaJoinColumn = (JoinColumnAnnotation) resourceField.addAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
javaJoinColumn.setName("FOO");
javaJoinColumn.setNullable(Boolean.FALSE);
getJpaProject().synchronizeContextModel();
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
+ JavaJoinColumn joinColumn = joinColumns.getSpecifiedJoinColumns().iterator().next();
assertEquals(Boolean.FALSE, joinColumn.getSpecifiedNullable());
assertEquals(Boolean.FALSE, javaJoinColumn.getNullable());
@@ -409,11 +410,11 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
@@ -421,7 +422,7 @@ public class JavaJoinColumnTests extends ContextModelTestCase
joinColumn.setSpecifiedName("foo");
joinColumn.setSpecifiedNullable(Boolean.FALSE);
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
assertEquals(Boolean.FALSE, joinColumn.getSpecifiedNullable());
assertEquals(Boolean.FALSE, javaJoinColumn.getNullable());
@@ -435,24 +436,24 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) resourceField.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
+ assertEquals(0, joinColumns.getSpecifiedJoinColumnsSize());
assertNull(javaJoinColumn);
//set insertable in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ javaJoinColumn = (JoinColumnAnnotation) resourceField.addAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
javaJoinColumn.setName("FOO");
javaJoinColumn.setInsertable(Boolean.FALSE);
getJpaProject().synchronizeContextModel();
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
+ JavaJoinColumn joinColumn = joinColumns.getSpecifiedJoinColumns().iterator().next();
assertEquals(Boolean.FALSE, joinColumn.getSpecifiedInsertable());
assertEquals(Boolean.FALSE, javaJoinColumn.getInsertable());
@@ -467,11 +468,11 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
@@ -479,7 +480,7 @@ public class JavaJoinColumnTests extends ContextModelTestCase
joinColumn.setSpecifiedName("foo");
joinColumn.setSpecifiedInsertable(Boolean.FALSE);
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
assertEquals(Boolean.FALSE, joinColumn.getSpecifiedInsertable());
assertEquals(Boolean.FALSE, javaJoinColumn.getInsertable());
@@ -493,24 +494,24 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
- assertEquals(0, joinColumns.specifiedJoinColumnsSize());
+ assertEquals(0, joinColumns.getSpecifiedJoinColumnsSize());
assertNull(javaJoinColumn);
//set updatable in the resource model, verify context model updated
- javaJoinColumn = (JoinColumnAnnotation) attributeResource.addAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ javaJoinColumn = (JoinColumnAnnotation) resourceField.addAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
javaJoinColumn.setName("FOO");
javaJoinColumn.setUpdatable(Boolean.FALSE);
getJpaProject().synchronizeContextModel();
- JavaJoinColumn joinColumn = joinColumns.specifiedJoinColumns().next();
+ JavaJoinColumn joinColumn = joinColumns.getSpecifiedJoinColumns().iterator().next();
assertEquals(Boolean.FALSE, joinColumn.getSpecifiedUpdatable());
assertEquals(Boolean.FALSE, javaJoinColumn.getUpdatable());
@@ -525,11 +526,11 @@ public class JavaJoinColumnTests extends ContextModelTestCase
createTestEntityWithOneToOne();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaOneToOneMapping oneToOneMapping = (JavaOneToOneMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinColumnRelationshipStrategy joinColumns = oneToOneMapping.getRelationship().getJoinColumnStrategy();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
JavaJoinColumn joinColumn = joinColumns.addSpecifiedJoinColumn(0);
@@ -537,7 +538,7 @@ public class JavaJoinColumnTests extends ContextModelTestCase
joinColumn.setSpecifiedName("foo");
joinColumn.setSpecifiedUpdatable(Boolean.FALSE);
- JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) attributeResource.getAnnotation(JoinColumnAnnotation.ANNOTATION_NAME);
+ JoinColumnAnnotation javaJoinColumn = (JoinColumnAnnotation) resourceField.getAnnotation(0, JoinColumnAnnotation.ANNOTATION_NAME);
assertEquals(Boolean.FALSE, joinColumn.getSpecifiedUpdatable());
assertEquals(Boolean.FALSE, javaJoinColumn.getUpdatable());
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaJoinTableTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaJoinTableTests.java
index 1192ab6221..f680861ebf 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaJoinTableTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaJoinTableTests.java
@@ -12,6 +12,10 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.MappingKeys;
@@ -24,8 +28,6 @@ import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable;
import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation;
import org.eclipse.jpt.jpa.core.tests.internal.context.ContextModelTestCase;
@@ -134,21 +136,21 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertNull(joinTable.getSpecifiedName());
assertNull(javaJoinTable);
//set name in the resource model, verify context model updated
- attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ javaJoinTable = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
javaJoinTable.setName("FOO");
getJpaProject().synchronizeContextModel();
assertEquals("FOO", joinTable.getSpecifiedName());
@@ -165,37 +167,37 @@ public class JavaJoinTableTests extends ContextModelTestCase
assertEquals("FOO", joinTable.getSpecifiedName());
assertEquals("FOO", javaJoinTable.getName());
- attributeResource.removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ resourceField.removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
assertNull(joinTable.getSpecifiedName());
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
}
public void testModifySpecifiedName() throws Exception {
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertNull(joinTable.getSpecifiedName());
assertNull(joinTableAnnotation);
//set name in the context model, verify resource model modified
joinTable.setSpecifiedName("foo");
- joinTableAnnotation = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertEquals("foo", joinTable.getSpecifiedName());
assertEquals("foo", joinTableAnnotation.getName());
//set name to null in the context model
joinTable.setSpecifiedName(null);
assertNull(joinTable.getSpecifiedName());
- joinTableAnnotation = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertNull(joinTableAnnotation.getName());
}
@@ -204,7 +206,7 @@ public class JavaJoinTableTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
//joinTable default name is null because targetEntity is not in the persistence unit
@@ -215,9 +217,9 @@ public class JavaJoinTableTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".Project");
assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
//target entity does not resolve, default name is null
manyToManyMapping.setSpecifiedTargetEntity("Foo");
@@ -228,9 +230,9 @@ public class JavaJoinTableTests extends ContextModelTestCase
assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName());
//add the join table annotation, verify default join table name is the same
- attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertEquals(TYPE_NAME + "_Project", joinTable.getDefaultName());
- assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
//set a table on the target entity, very default join table name updates
manyToManyMapping.getResolvedTargetEntity().getTable().setSpecifiedName("FOO");
@@ -245,10 +247,10 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithValidManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JoinColumn joinColumn = joinTable.joinColumns().next();
- JoinColumn inverseJoinColumn = joinTable.inverseJoinColumns().next();
+ JoinColumn joinColumn = joinTable.getJoinColumns().iterator().next();
+ JoinColumn inverseJoinColumn = joinTable.getInverseJoinColumns().iterator().next();
//joinTable default name is null because targetEntity is not in the persistence unit
assertNull(joinColumn.getDefaultName());
@@ -278,9 +280,9 @@ public class JavaJoinTableTests extends ContextModelTestCase
assertEquals("projects_proj_id", inverseJoinColumn.getDefaultName());
assertEquals("proj_id", inverseJoinColumn.getDefaultReferencedColumnName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
//target entity does not resolve, inverse join column name and referenced column name is null
manyToManyMapping.setSpecifiedTargetEntity("Foo");
@@ -297,12 +299,12 @@ public class JavaJoinTableTests extends ContextModelTestCase
assertEquals("proj_id", inverseJoinColumn.getDefaultReferencedColumnName());
//add the join table annotation, verify default join table name is the same
- attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertEquals(TYPE_NAME + "_MY_ID", joinColumn.getDefaultName());
assertEquals("MY_ID", joinColumn.getDefaultReferencedColumnName());
assertEquals("projects_proj_id", inverseJoinColumn.getDefaultName());
assertEquals("proj_id", inverseJoinColumn.getDefaultReferencedColumnName());
- assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
}
public void testDefaultJoinColumnsBidirectionalRelationship() throws Exception {
@@ -310,10 +312,10 @@ public class JavaJoinTableTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JoinColumn joinColumn = joinTable.joinColumns().next();
- JoinColumn inverseJoinColumn = joinTable.inverseJoinColumns().next();
+ JoinColumn joinColumn = joinTable.getJoinColumns().iterator().next();
+ JoinColumn inverseJoinColumn = joinTable.getInverseJoinColumns().iterator().next();
//joinTable default name is null because targetEntity is not in the persistence unit
assertNull(joinColumn.getDefaultName());
@@ -343,9 +345,9 @@ public class JavaJoinTableTests extends ContextModelTestCase
assertEquals("projects_proj_id", inverseJoinColumn.getDefaultName());
assertEquals("proj_id", inverseJoinColumn.getDefaultReferencedColumnName());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
//target entity does not resolve, inverse join column name and referenced column name is null
manyToManyMapping.setSpecifiedTargetEntity("Foo");
@@ -362,33 +364,33 @@ public class JavaJoinTableTests extends ContextModelTestCase
assertEquals("proj_id", inverseJoinColumn.getDefaultReferencedColumnName());
//add the join table annotation, verify default join table name is the same
- attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertEquals("employees_MY_ID", joinColumn.getDefaultName());
assertEquals("MY_ID", joinColumn.getDefaultReferencedColumnName());
assertEquals("projects_proj_id", inverseJoinColumn.getDefaultName());
assertEquals("proj_id", inverseJoinColumn.getDefaultReferencedColumnName());
- assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
}
public void testUpdateSpecifiedSchema() throws Exception {
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertNull(joinTable.getSpecifiedSchema());
assertNull(javaJoinTable);
//set schema in the resource model, verify context model updated
- attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ javaJoinTable = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
javaJoinTable.setSchema("FOO");
getJpaProject().synchronizeContextModel();
assertEquals("FOO", joinTable.getSpecifiedSchema());
@@ -405,37 +407,37 @@ public class JavaJoinTableTests extends ContextModelTestCase
assertEquals("FOO", joinTable.getSpecifiedSchema());
assertEquals("FOO", javaJoinTable.getSchema());
- attributeResource.removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ resourceField.removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
assertNull(joinTable.getSpecifiedSchema());
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
}
public void testModifySpecifiedSchema() throws Exception {
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType resourceType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute resourceAttribute = resourceType.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceAttribute.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertNull(joinTable.getSpecifiedSchema());
assertNull(joinTableAnnotation);
//set schema in the context model, verify resource model modified
joinTable.setSpecifiedSchema("foo");
- joinTableAnnotation = (JoinTableAnnotation) resourceAttribute.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertEquals("foo", joinTable.getSpecifiedSchema());
assertEquals("foo", joinTableAnnotation.getSchema());
//set schema to null in the context model
joinTable.setSpecifiedSchema(null);
assertNull(joinTable.getSpecifiedSchema());
- joinTableAnnotation = (JoinTableAnnotation) resourceAttribute.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertNull(joinTableAnnotation.getSchema());
}
@@ -443,21 +445,21 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JoinTableAnnotation javaJoinTable = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertNull(joinTable.getSpecifiedCatalog());
assertNull(javaJoinTable);
//set catalog in the resource model, verify context model updated
- attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- javaJoinTable = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ resourceField.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ javaJoinTable = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
javaJoinTable.setCatalog("FOO");
getJpaProject().synchronizeContextModel();
assertEquals("FOO", joinTable.getSpecifiedCatalog());
@@ -474,37 +476,37 @@ public class JavaJoinTableTests extends ContextModelTestCase
assertEquals("FOO", joinTable.getSpecifiedCatalog());
assertEquals("FOO", javaJoinTable.getCatalog());
- attributeResource.removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ resourceField.removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
getJpaProject().synchronizeContextModel();
assertNull(joinTable.getSpecifiedCatalog());
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
}
public void testModifySpecifiedCatalog() throws Exception {
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType resourceType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute resourceAttribute = resourceType.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceAttribute.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertNull(joinTable.getSpecifiedCatalog());
assertNull(joinTableAnnotation);
//set catalog in the context model, verify resource model modified
joinTable.setSpecifiedCatalog("foo");
- joinTableAnnotation = (JoinTableAnnotation) resourceAttribute.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertEquals("foo", joinTable.getSpecifiedCatalog());
assertEquals("foo", joinTableAnnotation.getCatalog());
//set catalog to null in the context model
joinTable.setSpecifiedCatalog(null);
assertNull(joinTable.getSpecifiedCatalog());
- joinTableAnnotation = (JoinTableAnnotation) resourceAttribute.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertNull(joinTableAnnotation.getCatalog());
}
@@ -512,17 +514,17 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
JoinColumn joinColumn = joinTable.addSpecifiedJoinColumn(0);
joinColumn.setSpecifiedName("FOO");
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JoinTableAnnotation joinTableResource = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertEquals("FOO", joinTableResource.joinColumnAt(0).getName());
@@ -539,12 +541,12 @@ public class JavaJoinTableTests extends ContextModelTestCase
assertEquals("BAZ", joinTableResource.joinColumnAt(1).getName());
assertEquals("FOO", joinTableResource.joinColumnAt(2).getName());
- ListIterator<JavaJoinColumn> joinColumns = joinTable.specifiedJoinColumns();
+ ListIterator<JavaJoinColumn> joinColumns = joinTable.getSpecifiedJoinColumns().iterator();
assertEquals(joinColumn2, joinColumns.next());
assertEquals(joinColumn3, joinColumns.next());
assertEquals(joinColumn, joinColumns.next());
- joinColumns = joinTable.specifiedJoinColumns();
+ joinColumns = joinTable.getSpecifiedJoinColumns().iterator();
assertEquals("BAR", joinColumns.next().getName());
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("FOO", joinColumns.next().getName());
@@ -554,52 +556,52 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType resourceType = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute resourceAttribute = resourceType.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
joinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
joinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
joinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceAttribute.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals(3, joinTableAnnotation.joinColumnsSize());
+ JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ assertEquals(3, joinTableAnnotation.getJoinColumnsSize());
joinTable.removeSpecifiedJoinColumn(0);
- assertEquals(2, joinTableAnnotation.joinColumnsSize());
+ assertEquals(2, joinTableAnnotation.getJoinColumnsSize());
assertEquals("BAR", joinTableAnnotation.joinColumnAt(0).getName());
assertEquals("BAZ", joinTableAnnotation.joinColumnAt(1).getName());
joinTable.removeSpecifiedJoinColumn(0);
- assertEquals(1, joinTableAnnotation.joinColumnsSize());
+ assertEquals(1, joinTableAnnotation.getJoinColumnsSize());
assertEquals("BAZ", joinTableAnnotation.joinColumnAt(0).getName());
joinTable.removeSpecifiedJoinColumn(0);
- assertEquals(0, joinTableAnnotation.joinColumnsSize());
+ assertEquals(0, joinTableAnnotation.getJoinColumnsSize());
}
public void testMoveSpecifiedJoinColumn() throws Exception {
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
joinTable.addSpecifiedJoinColumn(0).setSpecifiedName("FOO");
joinTable.addSpecifiedJoinColumn(1).setSpecifiedName("BAR");
joinTable.addSpecifiedJoinColumn(2).setSpecifiedName("BAZ");
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals(3, joinTableResource.joinColumnsSize());
+ JoinTableAnnotation joinTableResource = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ assertEquals(3, joinTableResource.getJoinColumnsSize());
joinTable.moveSpecifiedJoinColumn(2, 0);
- ListIterator<JavaJoinColumn> joinColumns = joinTable.specifiedJoinColumns();
+ ListIterator<JavaJoinColumn> joinColumns = joinTable.getSpecifiedJoinColumns().iterator();
assertEquals("BAR", joinColumns.next().getName());
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("FOO", joinColumns.next().getName());
@@ -610,7 +612,7 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTable.moveSpecifiedJoinColumn(0, 1);
- joinColumns = joinTable.specifiedJoinColumns();
+ joinColumns = joinTable.getSpecifiedJoinColumns().iterator();
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("BAR", joinColumns.next().getName());
assertEquals("FOO", joinColumns.next().getName());
@@ -624,13 +626,13 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JoinTableAnnotation joinTableResource = (JoinTableAnnotation) resourceField.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
joinTableResource.addJoinColumn(0);
joinTableResource.addJoinColumn(1);
@@ -641,7 +643,7 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTableResource.joinColumnAt(2).setName("BAZ");
getJpaProject().synchronizeContextModel();
- ListIterator<JavaJoinColumn> joinColumns = joinTable.specifiedJoinColumns();
+ ListIterator<JavaJoinColumn> joinColumns = joinTable.getSpecifiedJoinColumns().iterator();
assertEquals("FOO", joinColumns.next().getName());
assertEquals("BAR", joinColumns.next().getName());
assertEquals("BAZ", joinColumns.next().getName());
@@ -649,7 +651,7 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTableResource.moveJoinColumn(2, 0);
getJpaProject().synchronizeContextModel();
- joinColumns = joinTable.specifiedJoinColumns();
+ joinColumns = joinTable.getSpecifiedJoinColumns().iterator();
assertEquals("BAR", joinColumns.next().getName());
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("FOO", joinColumns.next().getName());
@@ -657,7 +659,7 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTableResource.moveJoinColumn(0, 1);
getJpaProject().synchronizeContextModel();
- joinColumns = joinTable.specifiedJoinColumns();
+ joinColumns = joinTable.getSpecifiedJoinColumns().iterator();
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("BAR", joinColumns.next().getName());
assertEquals("FOO", joinColumns.next().getName());
@@ -665,60 +667,60 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTableResource.removeJoinColumn(1);
getJpaProject().synchronizeContextModel();
- joinColumns = joinTable.specifiedJoinColumns();
+ joinColumns = joinTable.getSpecifiedJoinColumns().iterator();
assertEquals("BAZ", joinColumns.next().getName());
assertEquals("FOO", joinColumns.next().getName());
assertFalse(joinColumns.hasNext());
joinTableResource.removeJoinColumn(1);
getJpaProject().synchronizeContextModel();
- joinColumns = joinTable.specifiedJoinColumns();
+ joinColumns = joinTable.getSpecifiedJoinColumns().iterator();
assertEquals("BAZ", joinColumns.next().getName());
assertFalse(joinColumns.hasNext());
joinTableResource.removeJoinColumn(0);
getJpaProject().synchronizeContextModel();
- assertFalse(joinTable.specifiedJoinColumns().hasNext());
+ assertFalse(joinTable.getSpecifiedJoinColumns().iterator().hasNext());
}
public void testSpecifiedJoinColumnsSize() throws Exception {
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- assertEquals(0, joinTable.specifiedJoinColumnsSize());
+ assertEquals(0, joinTable.getSpecifiedJoinColumnsSize());
joinTable.addSpecifiedJoinColumn(0);
- assertEquals(1, joinTable.specifiedJoinColumnsSize());
+ assertEquals(1, joinTable.getSpecifiedJoinColumnsSize());
joinTable.removeSpecifiedJoinColumn(0);
- assertEquals(0, joinTable.specifiedJoinColumnsSize());
+ assertEquals(0, joinTable.getSpecifiedJoinColumnsSize());
}
public void testJoinColumnsSize() throws Exception {
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- assertEquals(1, joinTable.joinColumnsSize());
+ assertEquals(1, joinTable.getJoinColumnsSize());
joinTable.addSpecifiedJoinColumn(0);
- assertEquals(1, joinTable.joinColumnsSize());
+ assertEquals(1, joinTable.getJoinColumnsSize());
joinTable.addSpecifiedJoinColumn(0);
- assertEquals(2, joinTable.joinColumnsSize());
+ assertEquals(2, joinTable.getJoinColumnsSize());
joinTable.removeSpecifiedJoinColumn(0);
joinTable.removeSpecifiedJoinColumn(0);
- assertEquals(1, joinTable.joinColumnsSize());
+ assertEquals(1, joinTable.getJoinColumnsSize());
// default columns
assertNotNull(manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable());
- JavaResourcePersistentAttribute resAttribute = this.getJavaPersistentType().attributes().next().getResourcePersistentAttribute();
+ JavaResourceAttribute resAttribute = this.getJavaPersistentType().getAttributes().iterator().next().getResourceAttribute();
assertNotNull(resAttribute.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
manyToManyMapping.getRelationship().getJoinTableStrategy().removeStrategy();
// default join table
@@ -734,17 +736,17 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
JoinColumn inverseJoinColumn = joinTable.addSpecifiedInverseJoinColumn(0);
inverseJoinColumn.setSpecifiedName("FOO");
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JoinTableAnnotation joinTableResource = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
assertEquals("FOO", joinTableResource.inverseJoinColumnAt(0).getName());
@@ -761,12 +763,12 @@ public class JavaJoinTableTests extends ContextModelTestCase
assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(1).getName());
assertEquals("FOO", joinTableResource.inverseJoinColumnAt(2).getName());
- ListIterator<JavaJoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ ListIterator<JavaJoinColumn> inverseJoinColumns = joinTable.getSpecifiedInverseJoinColumns().iterator();
assertEquals(inverseJoinColumn2, inverseJoinColumns.next());
assertEquals(inverseJoinColumn3, inverseJoinColumns.next());
assertEquals(inverseJoinColumn, inverseJoinColumns.next());
- inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ inverseJoinColumns = joinTable.getSpecifiedInverseJoinColumns().iterator();
assertEquals("BAR", inverseJoinColumns.next().getName());
assertEquals("BAZ", inverseJoinColumns.next().getName());
assertEquals("FOO", inverseJoinColumns.next().getName());
@@ -776,52 +778,52 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
joinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO");
joinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR");
joinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ");
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals(3, joinTableResource.inverseJoinColumnsSize());
+ JoinTableAnnotation joinTableResource = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ assertEquals(3, joinTableResource.getInverseJoinColumnsSize());
joinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(2, joinTableResource.inverseJoinColumnsSize());
+ assertEquals(2, joinTableResource.getInverseJoinColumnsSize());
assertEquals("BAR", joinTableResource.inverseJoinColumnAt(0).getName());
assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(1).getName());
joinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(1, joinTableResource.inverseJoinColumnsSize());
+ assertEquals(1, joinTableResource.getInverseJoinColumnsSize());
assertEquals("BAZ", joinTableResource.inverseJoinColumnAt(0).getName());
joinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(0, joinTableResource.inverseJoinColumnsSize());
+ assertEquals(0, joinTableResource.getInverseJoinColumnsSize());
}
public void testMoveSpecifiedInverseJoinColumn() throws Exception {
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
joinTable.addSpecifiedInverseJoinColumn(0).setSpecifiedName("FOO");
joinTable.addSpecifiedInverseJoinColumn(1).setSpecifiedName("BAR");
joinTable.addSpecifiedInverseJoinColumn(2).setSpecifiedName("BAZ");
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals(3, joinTableResource.inverseJoinColumnsSize());
+ JoinTableAnnotation joinTableResource = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ assertEquals(3, joinTableResource.getInverseJoinColumnsSize());
joinTable.moveSpecifiedInverseJoinColumn(2, 0);
- ListIterator<JavaJoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ ListIterator<JavaJoinColumn> inverseJoinColumns = joinTable.getSpecifiedInverseJoinColumns().iterator();
assertEquals("BAR", inverseJoinColumns.next().getName());
assertEquals("BAZ", inverseJoinColumns.next().getName());
assertEquals("FOO", inverseJoinColumns.next().getName());
@@ -832,7 +834,7 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTable.moveSpecifiedInverseJoinColumn(0, 1);
- inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ inverseJoinColumns = joinTable.getSpecifiedInverseJoinColumns().iterator();
assertEquals("BAZ", inverseJoinColumns.next().getName());
assertEquals("BAR", inverseJoinColumns.next().getName());
assertEquals("FOO", inverseJoinColumns.next().getName());
@@ -846,13 +848,13 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
- JoinTableAnnotation joinTableResource = (JoinTableAnnotation) attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JoinTableAnnotation joinTableResource = (JoinTableAnnotation) resourceField.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
joinTableResource.addInverseJoinColumn(0);
joinTableResource.addInverseJoinColumn(1);
@@ -863,7 +865,7 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTableResource.inverseJoinColumnAt(2).setName("BAZ");
getJpaProject().synchronizeContextModel();
- ListIterator<JavaJoinColumn> inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ ListIterator<JavaJoinColumn> inverseJoinColumns = joinTable.getSpecifiedInverseJoinColumns().iterator();
assertEquals("FOO", inverseJoinColumns.next().getName());
assertEquals("BAR", inverseJoinColumns.next().getName());
assertEquals("BAZ", inverseJoinColumns.next().getName());
@@ -871,7 +873,7 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTableResource.moveInverseJoinColumn(2, 0);
getJpaProject().synchronizeContextModel();
- inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ inverseJoinColumns = joinTable.getSpecifiedInverseJoinColumns().iterator();
assertEquals("BAR", inverseJoinColumns.next().getName());
assertEquals("BAZ", inverseJoinColumns.next().getName());
assertEquals("FOO", inverseJoinColumns.next().getName());
@@ -879,7 +881,7 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTableResource.moveInverseJoinColumn(0, 1);
getJpaProject().synchronizeContextModel();
- inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ inverseJoinColumns = joinTable.getSpecifiedInverseJoinColumns().iterator();
assertEquals("BAZ", inverseJoinColumns.next().getName());
assertEquals("BAR", inverseJoinColumns.next().getName());
assertEquals("FOO", inverseJoinColumns.next().getName());
@@ -887,20 +889,20 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTableResource.removeInverseJoinColumn(1);
getJpaProject().synchronizeContextModel();
- inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ inverseJoinColumns = joinTable.getSpecifiedInverseJoinColumns().iterator();
assertEquals("BAZ", inverseJoinColumns.next().getName());
assertEquals("FOO", inverseJoinColumns.next().getName());
assertFalse(inverseJoinColumns.hasNext());
joinTableResource.removeInverseJoinColumn(1);
getJpaProject().synchronizeContextModel();
- inverseJoinColumns = joinTable.specifiedInverseJoinColumns();
+ inverseJoinColumns = joinTable.getSpecifiedInverseJoinColumns().iterator();
assertEquals("BAZ", inverseJoinColumns.next().getName());
assertFalse(inverseJoinColumns.hasNext());
joinTableResource.removeInverseJoinColumn(0);
getJpaProject().synchronizeContextModel();
- assertFalse(joinTable.specifiedInverseJoinColumns().hasNext());
+ assertFalse(joinTable.getSpecifiedInverseJoinColumns().iterator().hasNext());
}
public void testGetDefaultInverseJoinColumn() {
@@ -911,36 +913,36 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- assertEquals(0, joinTable.specifiedInverseJoinColumnsSize());
+ assertEquals(0, joinTable.getSpecifiedInverseJoinColumnsSize());
joinTable.addSpecifiedInverseJoinColumn(0);
- assertEquals(1, joinTable.specifiedInverseJoinColumnsSize());
+ assertEquals(1, joinTable.getSpecifiedInverseJoinColumnsSize());
joinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(0, joinTable.specifiedInverseJoinColumnsSize());
+ assertEquals(0, joinTable.getSpecifiedInverseJoinColumnsSize());
}
public void testInverseJoinColumnsSize() throws Exception {
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- assertEquals(1, joinTable.inverseJoinColumnsSize());
+ assertEquals(1, joinTable.getInverseJoinColumnsSize());
joinTable.addSpecifiedInverseJoinColumn(0);
- assertEquals(1, joinTable.inverseJoinColumnsSize());
+ assertEquals(1, joinTable.getInverseJoinColumnsSize());
joinTable.addSpecifiedInverseJoinColumn(0);
- assertEquals(2, joinTable.inverseJoinColumnsSize());
+ assertEquals(2, joinTable.getInverseJoinColumnsSize());
joinTable.removeSpecifiedInverseJoinColumn(0);
joinTable.removeSpecifiedInverseJoinColumn(0);
- assertEquals(1, joinTable.inverseJoinColumnsSize());
+ assertEquals(1, joinTable.getInverseJoinColumnsSize());
//if non-owning side of the relationship then no default join table
manyToManyMapping.getRelationship().setStrategyToMappedBy();
@@ -951,20 +953,20 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- ListIterator<JavaUniqueConstraint> uniqueConstraints = joinTable.uniqueConstraints();
+ ListIterator<JavaUniqueConstraint> uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertFalse(uniqueConstraints.hasNext());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceField.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
joinTableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo");
joinTableAnnotation.addUniqueConstraint(0).addColumnName(0, "bar");
getJpaProject().synchronizeContextModel();
- uniqueConstraints = joinTable.uniqueConstraints();
+ uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertTrue(uniqueConstraints.hasNext());
assertEquals("bar", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("foo", uniqueConstraints.next().getColumnNames().iterator().next());
@@ -975,39 +977,39 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- assertEquals(0, joinTable.uniqueConstraintsSize());
+ assertEquals(0, joinTable.getUniqueConstraintsSize());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceField.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
joinTableAnnotation.addUniqueConstraint(0).addColumnName(0, "foo");
joinTableAnnotation.addUniqueConstraint(1).addColumnName(0, "bar");
getJpaProject().synchronizeContextModel();
- assertEquals(2, joinTable.uniqueConstraintsSize());
+ assertEquals(2, joinTable.getUniqueConstraintsSize());
}
public void testAddUniqueConstraint() throws Exception {
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
joinTable.addUniqueConstraint(0).addColumnName(0, "FOO");
joinTable.addUniqueConstraint(0).addColumnName(0, "BAR");
joinTable.addUniqueConstraint(0).addColumnName(0, "BAZ");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- ListIterator<UniqueConstraintAnnotation> uniqueConstraints = joinTableAnnotation.uniqueConstraints();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ ListIterator<UniqueConstraintAnnotation> uniqueConstraints = joinTableAnnotation.getUniqueConstraints().iterator();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
+ assertEquals("BAZ", uniqueConstraints.next().columnNameAt(0));
+ assertEquals("BAR", uniqueConstraints.next().columnNameAt(0));
+ assertEquals("FOO", uniqueConstraints.next().columnNameAt(0));
assertFalse(uniqueConstraints.hasNext());
}
@@ -1015,20 +1017,20 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
joinTable.addUniqueConstraint(0).addColumnName(0, "FOO");
joinTable.addUniqueConstraint(1).addColumnName(0, "BAR");
joinTable.addUniqueConstraint(0).addColumnName(0, "BAZ");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- ListIterator<UniqueConstraintAnnotation> uniqueConstraints = joinTableAnnotation.uniqueConstraints();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ ListIterator<UniqueConstraintAnnotation> uniqueConstraints = joinTableAnnotation.getUniqueConstraints().iterator();
- assertEquals("BAZ", uniqueConstraints.next().columnNames().next());
- assertEquals("FOO", uniqueConstraints.next().columnNames().next());
- assertEquals("BAR", uniqueConstraints.next().columnNames().next());
+ assertEquals("BAZ", uniqueConstraints.next().columnNameAt(0));
+ assertEquals("FOO", uniqueConstraints.next().columnNameAt(0));
+ assertEquals("BAR", uniqueConstraints.next().columnNameAt(0));
assertFalse(uniqueConstraints.hasNext());
}
@@ -1036,45 +1038,45 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
joinTable.addUniqueConstraint(0).addColumnName(0, "FOO");
joinTable.addUniqueConstraint(1).addColumnName(0, "BAR");
joinTable.addUniqueConstraint(2).addColumnName(0, "BAZ");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals(3, joinTableAnnotation.uniqueConstraintsSize());
+ assertEquals(3, joinTableAnnotation.getUniqueConstraintsSize());
joinTable.removeUniqueConstraint(1);
- ListIterator<UniqueConstraintAnnotation> uniqueConstraintAnnotations = joinTableAnnotation.uniqueConstraints();
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
+ ListIterator<UniqueConstraintAnnotation> uniqueConstraintAnnotations = joinTableAnnotation.getUniqueConstraints().iterator();
+ assertEquals("FOO", uniqueConstraintAnnotations.next().columnNameAt(0));
+ assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNameAt(0));
assertFalse(uniqueConstraintAnnotations.hasNext());
- Iterator<JavaUniqueConstraint> uniqueConstraints = joinTable.uniqueConstraints();
+ Iterator<JavaUniqueConstraint> uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertEquals("FOO", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next());
assertFalse(uniqueConstraints.hasNext());
joinTable.removeUniqueConstraint(1);
- uniqueConstraintAnnotations = joinTableAnnotation.uniqueConstraints();
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
+ uniqueConstraintAnnotations = joinTableAnnotation.getUniqueConstraints().iterator();
+ assertEquals("FOO", uniqueConstraintAnnotations.next().columnNameAt(0));
assertFalse(uniqueConstraintAnnotations.hasNext());
- uniqueConstraints = joinTable.uniqueConstraints();
+ uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertEquals("FOO", uniqueConstraints.next().getColumnNames().iterator().next());
assertFalse(uniqueConstraints.hasNext());
joinTable.removeUniqueConstraint(0);
- uniqueConstraintAnnotations = joinTableAnnotation.uniqueConstraints();
+ uniqueConstraintAnnotations = joinTableAnnotation.getUniqueConstraints().iterator();
assertFalse(uniqueConstraintAnnotations.hasNext());
- uniqueConstraints = joinTable.uniqueConstraints();
+ uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertFalse(uniqueConstraints.hasNext());
}
@@ -1082,59 +1084,59 @@ public class JavaJoinTableTests extends ContextModelTestCase
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
joinTable.addUniqueConstraint(0).addColumnName(0, "FOO");
joinTable.addUniqueConstraint(1).addColumnName(0, "BAR");
joinTable.addUniqueConstraint(2).addColumnName(0, "BAZ");
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
- assertEquals(3, joinTableAnnotation.uniqueConstraintsSize());
+ assertEquals(3, joinTableAnnotation.getUniqueConstraintsSize());
joinTable.moveUniqueConstraint(2, 0);
- ListIterator<? extends UniqueConstraint> uniqueConstraints = joinTable.uniqueConstraints();
+ ListIterator<? extends UniqueConstraint> uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertEquals("BAR", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("FOO", uniqueConstraints.next().getColumnNames().iterator().next());
- ListIterator<UniqueConstraintAnnotation> uniqueConstraintAnnotations = joinTableAnnotation.uniqueConstraints();
- assertEquals("BAR", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
+ ListIterator<UniqueConstraintAnnotation> uniqueConstraintAnnotations = joinTableAnnotation.getUniqueConstraints().iterator();
+ assertEquals("BAR", uniqueConstraintAnnotations.next().columnNameAt(0));
+ assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNameAt(0));
+ assertEquals("FOO", uniqueConstraintAnnotations.next().columnNameAt(0));
joinTable.moveUniqueConstraint(0, 1);
- uniqueConstraints = joinTable.uniqueConstraints();
+ uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("BAR", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("FOO", uniqueConstraints.next().getColumnNames().iterator().next());
- uniqueConstraintAnnotations = joinTableAnnotation.uniqueConstraints();
- assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("BAR", uniqueConstraintAnnotations.next().columnNames().next());
- assertEquals("FOO", uniqueConstraintAnnotations.next().columnNames().next());
+ uniqueConstraintAnnotations = joinTableAnnotation.getUniqueConstraints().iterator();
+ assertEquals("BAZ", uniqueConstraintAnnotations.next().columnNameAt(0));
+ assertEquals("BAR", uniqueConstraintAnnotations.next().columnNameAt(0));
+ assertEquals("FOO", uniqueConstraintAnnotations.next().columnNameAt(0));
}
public void testUpdateUniqueConstraints() throws Exception {
createTestEntityWithManyToMany();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().attributes().next().getMapping();
+ JavaManyToManyMapping manyToManyMapping = (JavaManyToManyMapping) getJavaPersistentType().getAttributes().iterator().next().getMapping();
JavaJoinTable joinTable = manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) attributeResource.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ JoinTableAnnotation joinTableAnnotation = (JoinTableAnnotation) resourceField.addAnnotation(JoinTableAnnotation.ANNOTATION_NAME);
joinTableAnnotation.addUniqueConstraint(0).addColumnName("FOO");
joinTableAnnotation.addUniqueConstraint(1).addColumnName("BAR");
joinTableAnnotation.addUniqueConstraint(2).addColumnName("BAZ");
getJpaProject().synchronizeContextModel();
- ListIterator<JavaUniqueConstraint> uniqueConstraints = joinTable.uniqueConstraints();
+ ListIterator<JavaUniqueConstraint> uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertEquals("FOO", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("BAR", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next());
@@ -1142,7 +1144,7 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTableAnnotation.moveUniqueConstraint(2, 0);
getJpaProject().synchronizeContextModel();
- uniqueConstraints = joinTable.uniqueConstraints();
+ uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertEquals("BAR", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("FOO", uniqueConstraints.next().getColumnNames().iterator().next());
@@ -1150,7 +1152,7 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTableAnnotation.moveUniqueConstraint(0, 1);
getJpaProject().synchronizeContextModel();
- uniqueConstraints = joinTable.uniqueConstraints();
+ uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("BAR", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("FOO", uniqueConstraints.next().getColumnNames().iterator().next());
@@ -1158,20 +1160,20 @@ public class JavaJoinTableTests extends ContextModelTestCase
joinTableAnnotation.removeUniqueConstraint(1);
getJpaProject().synchronizeContextModel();
- uniqueConstraints = joinTable.uniqueConstraints();
+ uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next());
assertEquals("FOO", uniqueConstraints.next().getColumnNames().iterator().next());
assertFalse(uniqueConstraints.hasNext());
joinTableAnnotation.removeUniqueConstraint(1);
getJpaProject().synchronizeContextModel();
- uniqueConstraints = joinTable.uniqueConstraints();
+ uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertEquals("BAZ", uniqueConstraints.next().getColumnNames().iterator().next());
assertFalse(uniqueConstraints.hasNext());
joinTableAnnotation.removeUniqueConstraint(0);
getJpaProject().synchronizeContextModel();
- uniqueConstraints = joinTable.uniqueConstraints();
+ uniqueConstraints = joinTable.getUniqueConstraints().iterator();
assertFalse(uniqueConstraints.hasNext());
}
} \ No newline at end of file
diff --git a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaManyToManyMappingTests.java b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaManyToManyMappingTests.java
index b1e73a63a6..6f5246237d 100644
--- a/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaManyToManyMappingTests.java
+++ b/jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaManyToManyMappingTests.java
@@ -12,6 +12,9 @@ package org.eclipse.jpt.jpa.core.tests.internal.context.java;
import java.util.Iterator;
import java.util.ListIterator;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceField;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceType;
+import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter;
import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator;
import org.eclipse.jpt.jpa.core.MappingKeys;
@@ -38,8 +41,6 @@ import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.JPA;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
-import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation;
@@ -299,7 +300,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
manyToManyMapping.getOrderable().setSpecifiedOrderBy("asdf");
manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable().setSpecifiedName("FOO");
@@ -309,19 +310,19 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
assertTrue(persistentAttribute.getMapping() instanceof BasicMapping);
assertFalse(persistentAttribute.getMapping().isDefault());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(BasicAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
}
public void testMorphToDefault() throws Exception {
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
manyToManyMapping.getOrderable().setSpecifiedOrderBy("asdf");
manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable().setSpecifiedName("FOO");
@@ -330,18 +331,18 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
persistentAttribute.setMappingKey(MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY);
assertTrue(persistentAttribute.getMapping().isDefault());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
}
public void testMorphToVersionMapping() throws Exception {
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
manyToManyMapping.getOrderable().setSpecifiedOrderBy("asdf");
manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable().setSpecifiedName("FOO");
@@ -351,19 +352,19 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
assertTrue(persistentAttribute.getMapping() instanceof VersionMapping);
assertFalse(persistentAttribute.getMapping().isDefault());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(VersionAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(VersionAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
}
public void testMorphToIdMapping() throws Exception {
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
manyToManyMapping.getOrderable().setSpecifiedOrderBy("asdf");
manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable().setSpecifiedName("FOO");
@@ -373,19 +374,19 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
assertTrue(persistentAttribute.getMapping() instanceof IdMapping);
assertFalse(persistentAttribute.getMapping().isDefault());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(IdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
}
public void testMorphToEmbeddedMapping() throws Exception {
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
manyToManyMapping.getOrderable().setSpecifiedOrderBy("asdf");
manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable().setSpecifiedName("FOO");
@@ -395,19 +396,19 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
assertTrue(persistentAttribute.getMapping() instanceof EmbeddedMapping);
assertFalse(persistentAttribute.getMapping().isDefault());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(EmbeddedAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
}
public void testMorphToEmbeddedIdMapping() throws Exception {
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
manyToManyMapping.getOrderable().setSpecifiedOrderBy("asdf");
manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable().setSpecifiedName("FOO");
@@ -417,19 +418,19 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
assertTrue(persistentAttribute.getMapping() instanceof EmbeddedIdMapping);
assertFalse(persistentAttribute.getMapping().isDefault());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(EmbeddedIdAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
}
public void testMorphToTransientMapping() throws Exception {
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
manyToManyMapping.getOrderable().setSpecifiedOrderBy("asdf");
manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable().setSpecifiedName("FOO");
@@ -439,19 +440,19 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
assertTrue(persistentAttribute.getMapping() instanceof TransientMapping);
assertFalse(persistentAttribute.getMapping().isDefault());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(TransientAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(TransientAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
}
public void testMorphToOneToOneMapping() throws Exception {
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
manyToManyMapping.getOrderable().setSpecifiedOrderBy("asdf");
manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable().setSpecifiedName("FOO");
@@ -461,19 +462,19 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
assertTrue(persistentAttribute.getMapping() instanceof OneToOneMapping);
assertFalse(persistentAttribute.getMapping().isDefault());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(OneToOneAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
}
public void testMorphToOneToManyMapping() throws Exception {
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
manyToManyMapping.getOrderable().setSpecifiedOrderBy("asdf");
manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable().setSpecifiedName("FOO");
@@ -483,19 +484,19 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
assertTrue(persistentAttribute.getMapping() instanceof OneToManyMapping);
assertFalse(persistentAttribute.getMapping().isDefault());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(OneToManyAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
}
public void testMorphToManyToOneMapping() throws Exception {
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
manyToManyMapping.getOrderable().setSpecifiedOrderBy("asdf");
manyToManyMapping.getRelationship().getJoinTableStrategy().getJoinTable().setSpecifiedName("FOO");
@@ -505,24 +506,24 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
assertTrue(persistentAttribute.getMapping() instanceof ManyToOneMapping);
assertFalse(persistentAttribute.getMapping().isDefault());
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- assertNull(attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
- assertNotNull(attributeResource.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
- assertNull(attributeResource.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ assertNull(resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(ManyToOneAnnotation.ANNOTATION_NAME));
+ assertNotNull(resourceField.getAnnotation(JoinTableAnnotation.ANNOTATION_NAME));
+ assertNull(resourceField.getAnnotation(OrderByAnnotation.ANNOTATION_NAME));
}
public void testUpdateSpecifiedTargetEntity() throws Exception {
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToManyAnnotation manyToManyAnnotation = (ManyToManyAnnotation) attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ManyToManyAnnotation manyToManyAnnotation = (ManyToManyAnnotation) resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME);
assertNull(manyToManyMapping.getSpecifiedTargetEntity());
assertNull(manyToManyAnnotation.getTargetEntity());
@@ -544,12 +545,12 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME);
assertNull(manyToManyMapping.getSpecifiedTargetEntity());
assertNull(manyToMany.getTargetEntity());
@@ -569,12 +570,12 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME);
assertNull(manyToManyMapping.getSpecifiedFetch());
assertNull(manyToMany.getFetch());
@@ -602,12 +603,12 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME);
assertNull(manyToManyMapping.getSpecifiedFetch());
assertNull(manyToMany.getFetch());
@@ -631,12 +632,12 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME);
assertNull(manyToManyMapping.getRelationship().getMappedByStrategy().getMappedByAttribute());
assertNull(manyToMany.getMappedBy());
@@ -658,12 +659,12 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
- JavaResourcePersistentType typeResource = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute attributeResource = typeResource.persistableAttributes().next();
- ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) attributeResource.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME);
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ManyToManyAnnotation manyToMany = (ManyToManyAnnotation) resourceField.getAnnotation(ManyToManyAnnotation.ANNOTATION_NAME);
assertNull(manyToManyMapping.getRelationship().getMappedByStrategy().getMappedByAttribute());
assertNull(manyToMany.getMappedBy());
@@ -683,25 +684,26 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute resourceAttribute = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next();
- ManyToManyAnnotation annotation = (ManyToManyAnnotation) resourceAttribute.getAnnotation(JPA.MANY_TO_MANY);
- PersistentAttribute contextAttribute = getJavaPersistentType().attributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ManyToManyAnnotation annotation = (ManyToManyAnnotation) resourceField.getAnnotation(JPA.MANY_TO_MANY);
+ PersistentAttribute contextAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping mapping = (ManyToManyMapping) contextAttribute.getMapping();
ManyToManyRelationship rel = mapping.getRelationship();
- assertNull(resourceAttribute.getAnnotation(JPA.JOIN_TABLE));
+ assertNull(resourceField.getAnnotation(JPA.JOIN_TABLE));
assertNull(annotation.getMappedBy());
assertTrue(rel.strategyIsJoinTable());
assertFalse(rel.strategyIsMappedBy());
rel.setStrategyToMappedBy();
- assertNull(resourceAttribute.getAnnotation(JPA.JOIN_TABLE));
+ assertNull(resourceField.getAnnotation(JPA.JOIN_TABLE));
assertNotNull(annotation.getMappedBy());
assertFalse(rel.strategyIsJoinTable());
assertTrue(rel.strategyIsMappedBy());
rel.setStrategyToJoinTable();
- assertNull(resourceAttribute.getAnnotation(JPA.JOIN_TABLE));
+ assertNull(resourceField.getAnnotation(JPA.JOIN_TABLE));
assertNull(annotation.getMappedBy());
assertTrue(rel.strategyIsJoinTable());
assertFalse(rel.strategyIsMappedBy());
@@ -711,41 +713,42 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
createTestEntityWithManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- JavaResourcePersistentAttribute resourceAttribute = getJpaProject().getJavaResourcePersistentType(FULLY_QUALIFIED_TYPE_NAME).persistableAttributes().next();
- ManyToManyAnnotation annotation = (ManyToManyAnnotation) resourceAttribute.getAnnotation(JPA.MANY_TO_MANY);
- PersistentAttribute contextAttribute = getJavaPersistentType().attributes().next();
+ JavaResourceType resourceType = (JavaResourceType) getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, Kind.TYPE);
+ JavaResourceField resourceField = resourceType.getFields().iterator().next();
+ ManyToManyAnnotation annotation = (ManyToManyAnnotation) resourceField.getAnnotation(JPA.MANY_TO_MANY);
+ PersistentAttribute contextAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping mapping = (ManyToManyMapping) contextAttribute.getMapping();
ManyToManyRelationship rel = mapping.getRelationship();
- assertNull(resourceAttribute.getAnnotation(JPA.JOIN_TABLE));
+ assertNull(resourceField.getAnnotation(JPA.JOIN_TABLE));
assertNull(annotation.getMappedBy());
assertTrue(rel.strategyIsJoinTable());
assertFalse(rel.strategyIsMappedBy());
annotation.setMappedBy("foo");
getJpaProject().synchronizeContextModel();
- assertNull(resourceAttribute.getAnnotation(JPA.JOIN_TABLE));
+ assertNull(resourceField.getAnnotation(JPA.JOIN_TABLE));
assertNotNull(annotation.getMappedBy());
assertFalse(rel.strategyIsJoinTable());
assertTrue(rel.strategyIsMappedBy());
- resourceAttribute.addAnnotation(JPA.JOIN_TABLE);
+ resourceField.addAnnotation(JPA.JOIN_TABLE);
getJpaProject().synchronizeContextModel();
- assertNotNull(resourceAttribute.getAnnotation(JPA.JOIN_TABLE));
+ assertNotNull(resourceField.getAnnotation(JPA.JOIN_TABLE));
assertNotNull(annotation.getMappedBy());
assertFalse(rel.strategyIsJoinTable());
assertTrue(rel.strategyIsMappedBy());
annotation.setMappedBy(null);
getJpaProject().synchronizeContextModel();
- assertNotNull(resourceAttribute.getAnnotation(JPA.JOIN_TABLE));
+ assertNotNull(resourceField.getAnnotation(JPA.JOIN_TABLE));
assertNull(annotation.getMappedBy());
assertTrue(rel.strategyIsJoinTable());
assertFalse(rel.strategyIsMappedBy());
- resourceAttribute.removeAnnotation(JPA.JOIN_TABLE);
+ resourceField.removeAnnotation(JPA.JOIN_TABLE);
getJpaProject().synchronizeContextModel();
- assertNull(resourceAttribute.getAnnotation(JPA.JOIN_TABLE));
+ assertNull(resourceField.getAnnotation(JPA.JOIN_TABLE));
assertNull(annotation.getMappedBy());
assertTrue(rel.strategyIsJoinTable());
assertFalse(rel.strategyIsMappedBy());
@@ -759,7 +762,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
addXmlClassRef(PACKAGE_NAME + ".Address");
addXmlClassRef(PACKAGE_NAME + ".State");
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
Iterator<String> attributeNames =
@@ -793,7 +796,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
createTestTargetEntityAddress();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
//targetEntity not in the persistence unit, default still set, handled by validation
@@ -807,7 +810,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
manyToManyMapping.setSpecifiedTargetEntity("foo");
assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getDefaultTargetEntity());
- ListIterator<ClassRef> classRefs = getPersistenceUnit().specifiedClassRefs();
+ ListIterator<ClassRef> classRefs = getPersistenceUnit().getSpecifiedClassRefs().iterator();
classRefs.next();
ClassRef addressClassRef = classRefs.next();
JavaPersistentType addressPersistentType = addressClassRef.getJavaPersistentType();
@@ -823,7 +826,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".Address");
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
assertNull(manyToManyMapping.getDefaultTargetEntity());
@@ -835,7 +838,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
addXmlClassRef(PACKAGE_NAME + ".Address");
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
assertNull(manyToManyMapping.getDefaultTargetEntity());
@@ -846,7 +849,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
createTestTargetEntityAddress();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
assertEquals(PACKAGE_NAME + ".Address", manyToManyMapping.getTargetEntity());
@@ -862,7 +865,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
createTestEntityWithValidManyToManyMapping();
addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);
- PersistentAttribute persistentAttribute = getJavaPersistentType().attributes().next();
+ PersistentAttribute persistentAttribute = getJavaPersistentType().getAttributes().iterator().next();
ManyToManyMapping manyToManyMapping = (ManyToManyMapping) persistentAttribute.getMapping();
//targetEntity not in the persistence unit
@@ -871,7 +874,7 @@ public class JavaManyToManyMappingTests extends ContextModelTestCase
//add targetEntity to the persistence unit, now target entity should resolve
createTestTargetEntityAddress();
addXmlClassRef(PACKAGE_NAME + ".Address");